Inconsistent behaviour with Litespeed Cache
-
This might be out-of-scope for this plugin, but if the
iframeis lazy-loaded by the Litespeed Cache Plugin, then your.play-buttonis still added to the page, but the click doesn’t triggerautoplayon theiframe.By watching the behaviour in the browser inspector, I can see that your script still removes the
templatetag when the button is clicked. Your script adds the iframe to the page, which is evident because I’ve modified your script to add thedata-wilkinsonattribute. I’ve also addedautoplay="autoplay", just in case that was the problem: it isn’t. This doesn’t actually start the video playing when the iframe is inserted.If I disable LCP on this page, the autoplay works as you originally programmed it. Therefore, I’d suggest you check to see whether the iframe is being lazy-loaded. The HTML of the iframe when it’s being lazy-loaded by LCP is:
<iframe data-lazyloaded="1" src="about:blank" title="Haytor 2023" width="1280" height="720" data-src="https://www.youtube.com/embed/mBaxkFq2jxM?feature=oembed&hq=1" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>(Note: I’ve since deactivated lazy-loading of the iframes in LCP so that the page works as intended.)
The page I need help with: [log in to see the link]
The topic ‘Inconsistent behaviour with Litespeed Cache’ is closed to new replies.