XF 2.2 Refreshing Iframe When Overlay Closed

John917

Active member
I'm using this code to post a page node in an overlay. The page node has an iframe of a video.
<a href="/pages/video/" data-xf-click="overlay">

Everything works swell but when I close the overlay, the video still plays.

Is there any way I can get the iframe to refresh (since the video loads paused) or the video to stop when I close the overlay?


Not sure but this script snippet below helps with refreshing iframe I think.
Code:
            function reload() {
                document.getElementById('iframeid').src += '';
            }
 
You could the data-nocache="true" to the overlay link. That will remove the overlay from the page dom when it's closed (otherwise it's just hidden, but still there).
 
You could the data-nocache="true" to the overlay link. That will remove the overlay from the page dom when it's closed (otherwise it's just hidden, but still there).
So it turns out my android phone stops the video without the data-nocache. However, my iphone 7 safari keeps playing despite having data-nocache enabled.

Maybe the newer iphones will have no problems :/

**Edit same issue with desktop microsoft edge
 
Last edited:
I wouldn't rely on the video to actually stop across different browsers based on if the overlay is hidden or not. You definitely will get a more consistent result with the data-nocache="true" attribute because then the overlay is removed from the dom (along with anything in the overlay, like the video). It will definitely stop playing regardless of the browser if you remove the video like that. :)
 
Thanks for the tip digitalpoint! Am I using the code correctly below?
<a href="/pages/guide_register/" data-xf-click="overlay" data-nocache="true">test</a>

Seems to have not made a change on my end but perhaps there's something interfering with it.

Btw, didn't know you ran that SEO website, I remember running into that forum years ago! Lots of respect. I'll pm you about your ad services too.
 
Oh wait... I think I gave you the one for menus, not overlays. Try this attribute: data-cache="off"
Tried that one too. No go. It may be due to the fact the video is an inframe embed?
Only way to turn it off seems to be to be able to refresh the iframe somehow but I can't find the proper trigger for when the user presses the close button on the overlay.
 
Not sure why it being an iframe would matter. If the iframe is in the overlay, and then you remove the overlay and iframe completely from the dom, I wouldn't think it would keep playing (since it doesn't exist anymore).
 
Yea it could be something in my templates that's interfering (custom style). Stuck on this one xP

Thanks for the help digitalpoint
 
Back
Top Bottom