iFrameResizer works perfectly with native lazy loading functionality in supported browsers. But I can't get it to work along with this polyfill. I think it is due to <noscript> tag usage, but I'm not sure.
I've tried following combinations to no avail:
<noscript class="loading-lazy">
<iframe id="container" src="..." loading="lazy"></iframe>
<script type="text/javascript">iFrameResize({}, '#container')</script>
</noscript>
<noscript class="loading-lazy">
<iframe id="container" src="..." loading="lazy"></iframe>
</noscript>
<script type="text/javascript">iFrameResize({}, '#container')</script>
The last one works when contents of the <iframe> is loaded instantly, but not with lazy loading:
<noscript class="loading-lazy">
<iframe id="container" src="..." loading="lazy" onload="iFrameResize({}, this)"></iframe>
</noscript>
It'd be great if there was a way to register callback function which fires when <iframe> is actually loaded, like this:
loadingAttributePolyfill.prepareElement(document.querySelector('main noscript.loading-lazy'), function () {
iFrameResize({}, '#container');
});
iFrameResizer works perfectly with native lazy loading functionality in supported browsers. But I can't get it to work along with this polyfill. I think it is due to
<noscript>tag usage, but I'm not sure.I've tried following combinations to no avail:
The last one works when contents of the
<iframe>is loaded instantly, but not with lazy loading:It'd be great if there was a way to register callback function which fires when
<iframe>is actually loaded, like this: