Important Notice: Limited Support During Summer Vacation (August 21 - August 26)

It's that time of the year again: summer! And with it, the holidays are just around the corner.
I don't know what your plans are, but I will be heading out with my family to enjoy the outdoors and recharge for the second half of the year.

No bug JCHoptimize of iframes thwarts ochFitvids

More
5 years 8 months ago - 5 years 8 months ago #1482 by Tim Davis
Hi Ruud,

I have discovered that when JCHoptimize is set to lazy load iframes, och Fitvids does not work. Just letting you know.

Here is a sample iframe code with JCH lazyload fingerprints on it:
Code:
<div class="responsive-video"><iframe class="jch-lazyload" src="about:blank" data-src="https://www.youtube.com/embed/e9yE7ZyNUDs" width="560" height="315" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
Last edit: 5 years 8 months ago by Tim Davis.

Please Log in to join the conversation.

More
5 years 8 months ago #1484 by Ruud van Lent
Replied by Ruud van Lent on topic JCHoptimize of iframes thwarts ochFitvids
Hi Tim,
JCH is known (at least for me) to rule the web as they are the only extension installed. When there are issues with extensions / plugins first question i ask is always is JCH Optimize installed: if yes, turn it off and see if that fixes the issue.

That said: What I see in the iframe code you provided, JCH is using a very 'old fashioned' lazyloading via a javascript. There are currently lazy loading standards introduced in all (modern) browsers that do not break the web.

JCH Optimize breaks the iframe by removing the src attribute. by doing that the iFrame cannot load because there is nothing to load. When the broken iFrame comes into to view, JCH repairs the iFrame by re-adding the src attribute.

Long ago, that was a very tricky lazy loading implementation. Since then the world has moved on and lazy loading is now a browser standard. You can simply add the loading="lazy" attribute to any iFrame and the browser will handle it as such.
like this:
Code:
<iframe src="video-player.html" title="..." loading="lazy"></iframe>

ochFitVids requires a intact iFrame as a broken iFrame is no iFrame :)

Please Log in to join the conversation.

More
5 years 8 months ago #1488 by Ruud van Lent
Replied by Ruud van Lent on topic JCHoptimize of iframes thwarts ochFitvids
Maybe I can have ochFitVids set the loading='lazy' element on iFrames it finds and processes. That way you have optimum sized videos AND lay loading conform latest standards (which Google likes as this is a standard I believe they introduced, or took part in).

Please Log in to join the conversation.