I know there are question have been asked around resembling to this one, but still I am not getting proper concept of this. I am currently loading an iframe through javascript in following manner:
jQuery('.out-div-login').html("<iframe id='parent' frameBorder='0' width='320' height='500' src='"+_url+"'></iframe>");
Which is working fine. (its cross domain). After loading my application inside given iframe, I want to come back to original state where .out-div-login
was loading iframe into parent html.
From outside of iframe I can do this by accessing iframe using its id
attribute, but not from the inside. Is there any way I can reload the iframe by giving its src again ? or by above code but from inside the iframe ? Thanks.
Update
I have tried below code without any success as of now:
var ifr = $('iframe[id="parent"]');
from one of js file inside iframe
with id parent
. when I do console.log(ifr)
it gives in firebug something like this Object[]
instead of <iframe id="parent">
You should use location.href
inside the iframe. That should work. set location.href in the iframe to your new location.
The url query string (?xxx) should also be kept in the new url, so the whole solution should be:
location.href = "new_link_url" + location.search;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With