davidjbradshaw / iframe-resizer

Keep iFrames sized to their content.
https://iframe-resizer.com
Other
6.68k stars 982 forks source link

downsize seemingly not working on chromium? #1355

Open jan-usc opened 2 days ago

jan-usc commented 2 days ago

Describe the bug resizing iframe (up- and downsizing) works perfectly on firefox, but seemingly not in chromium browsers

To Reproduce Steps to reproduce the behavior:

  1. Go to https://www.dav-usc-muenchen.de/iframe
  2. select "Alle Touren/Kurse nach Datum'' in the select box "Bitte wählen"
  3. the iframe is nicely upsized
  4. select "Kanu' in the select box "Bitte wählen"
  5. iframe not downsized (if using chromium browser, eg Chrome, edge, see first screenshot) 5.b iframe downsized accordingly (if using firefox, see scons screenshot)

Expected behavior iframe downsized also when using chromium browser.

Screenshots If applicable, add screenshots to help explain your problem. grafik grafik

Desktop (please complete the following information):

Smartphone (please complete the following information): n/a

Additional context Add any other context about the problem here.

Any help greatly appreciated!

davidjbradshaw commented 2 days ago

Hi,

This will turn out to be a CSS issue. iframe-resizer manages to work around most of these, but have a look at this page that details a few ways CSS can trip things up and how to work around them.

https://iframe-resizer.com/content_guidelines/

I’m interested to know how this only affects Chrome, so will take a more detailed look later in the week. It would be very helpful if you could install the latest beta version and turn logging on to enable me to see what is happening.

npm i @iframe-resizer/child@beta
jan-usc commented 2 days ago

Hi,

thx for your quick reply!

I referenced the beta on the child page and activated logging

seems that under Chrome the calculated size doesnt change when the content of the iframe is shrinked (screenshot1), whereas the size changes if FF (screenshot2)

grafik grafik

davidjbradshaw commented 2 days ago

Looking at those logs, it appears that you’re loading a new page into the iframe. As part of the page setup iframe-resizer sets the height of both the body and html elements to auto. It appears that something on your page is overriding this value in Chrome or not allowing another element inside it to shrink.

The interesting bit, is that after the initial size calculation is done, it appears not to be happy with this and checks it another two times, but your page CSS is still reporting that the body hasn’t downsized.

So my question is how is that height value on body being set in Chrome?

jan-usc commented 1 day ago

Yes, I do load a new page into the iframe whenever the selection in the select changes. Unfortunately, the webapp within the iframe is based on a rather old framework, the pages are server-side generated whenever an action occurs in the browser. Not a modern single-page client side js app.

Regarding your question, I'll try to find out, but I need the help of a colleague.