Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infinite resize (enlarging) loop #594

Closed
snarfed opened this issue Jun 7, 2018 · 6 comments
Closed

infinite resize (enlarging) loop #594

snarfed opened this issue Jun 7, 2018 · 6 comments

Comments

@snarfed
Copy link

snarfed commented Jun 7, 2018

hi! first off, thank you for iframe-resizer. it's awesome!

i'm seeing an infinite resize loop when i use it with a Metabase embedded dashboard in an iframe.

this is with iframe-resizer 3.5.15. looking at the changelog, the changes since then seem unrelated, but feel free to let me know if you think it might already be fixed. reproduces for me in firefox 60, chrome 66, and safari 11.1.1 on mac os x 10.13.5.

here's the outer page's HTML:

<!DOCTYPE html>
<html>
<head>
<script src="http://localhost:3000/app/iframeResizer.js"></script>
</head>
<body>
foo bar baz
<iframe src="http://localhost:3000/public/dashboard/440e3f82-9c7a-4822-a244-7fb038a5eee4"
        id="metabase" frameborder="0" width="100%" allowtransparency>
</iframe>
<script>iFrameResize({log: true}, "#metabase");</script>
</body>
</html>

one possible cause is that Metabase itself uses window.parent.postMessage() to send messages to the top-level page, so i wonder if iframe-resizer is accidentally handling those. here's an example message payload from Metabase:

{
  source: "Metabase",
  name: "dashboard-parameters",
  value: "?min=3&max=5"
}

possibly related: #7, #58, https://stackoverflow.com/questions/48563508

metabase docs that recommend iframe-resizer usage: https://www.metabase.com/docs/latest/administration-guide/13-embedding.html#resizing-dashboards-to-fit-their-content

thanks in advance!

@douglaspetrin
Copy link

@snarfed I "fixed" the issue temporarily by setting the autoResize : false and changing the limit of the iframe height, but I wish it could be differently.

@davidjbradshaw
Copy link
Owner

davidjbradshaw commented Jun 8, 2018

The most common cause of the is CSS setting a style to be taller than the page, everytime the page resizes, the CSS sizes past the bottome of the page and around we go again.

Have you tried using the tolerence option as that can sometimes help. The other thing to try is the different height calculation methods, as this can sometimes help.

PostMessage is unlikly to be the issue, as we ignore messages not for iframe resizing.

@snarfed
Copy link
Author

snarfed commented Jun 19, 2018

The most common cause of the is CSS setting a style to be taller than the page, everytime the page resizes, the CSS sizes past the bottome of the page and around we go again.

good guess! this was indeed the issue. details in metabase/metabase#7903. different height calculation methods didn't help, so i ended up overriding the offending CSS rule. tolerance would probably work too, but the difference in this case is ~150px, which is a bit big to ignore.

@snarfed
Copy link
Author

snarfed commented Jun 19, 2018

@davidjbradshaw i know it's probably a big request, but if this has happened before, you all might consider adding loop detection to at least prevent the infinite loop in these kinds of cases. just a thought.

@AkselsLedins
Copy link

Tolerance didn't work for me (as the different height calculation methods) and we are experiencing the same problem in a similar configuration @snarfed

@randlet-rf
Copy link

Long dead thread but for anyone else who comes across this, I had this same issue with nested iframes growing withoug bound. I was using:

        log: true,
        bodyPadding: '10px',
        autoResize: true,
      }

as my settings. Removing the bodyPadding fixed the issue for me. Thanks @davidjbradshaw for your work on this library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants