Iframe help

Page: 1

Author Post
Registered: May 2016
Posts: 9
Hi All
I cannot for the life of me get the iframe that called the floatbox to refresh.
Iframe name is my_iframe.
I call the floatbox from a link within the iframe.
They click the close link.
Floatbox closes but the whole page refreshes and the iframe get reset to the default.
There is only one iframe on the parent page, with menu tabs at the top that target the iframe to change its content.

I assume I put some code on the link that calls the iframe
with data-fb-options parameters. All the options I have tried have not worked.

Any help is greatly appreciated.
Registered: Aug 2008
Posts: 3382
I'm not sure what you are doing to initiate the page refresh, but let's work with putting something like "location.refresh()" in an 'afterBoxEnd' callback.

The important thing to note is that floatboxes that start from a link in an iframe don't normally attach to that iframe's document. They attach to the parent or top document, as is evident from the fact that they visually display over the top document and are not confined to the boundaries of the iframe window.

So, running in the top window, a call such as "location.refresh()" will refresh that top window. To refresh an iframe's content from code running outside of that iframe, we first must get a reference to the iframe's window and then use the location object of that window.

First, put an id on the <iframe> element - it's easier to work with than a name.
Get a reference to the iframe element with document.getElementById( 'theId') , or the simpler fb.$( 'theId' ) function.
Once we have the iframe, it's window object can be found as the .contentWindow property of that iframe.
And then of course having that window object, we can reference its location as the .location property of that window.

Assembling those pieces together into an afterBoxEnd callback could result in something like this:
"afterBoxEnd:`fb.$( 'theId' ).contentWindow.location.reload()`"
Registered: May 2016
Posts: 9
Thanks for your prompt reply!

Is this a part of a javascript call on the close link>

or is this on the data-fb-options?
Nevermind I went and put it on the data-fb-options and it worked like a charm!


GREAT product by the way...
« Last edit by ckroon1 on Fri May 06, 2016 1:25 am. »

Page: 1