refresh iframe from inside itself with different domains
12,869
In your script within the iframe, try this:
document.location.href = document.location.href;
You can't access elements outside of your document model from within the iframe, including accessing the iframe itself. You can access the properties of the document within it however.
Related videos on Youtube
Author by
Dustin Silk
Updated on June 04, 2022Comments
-
Dustin Silk almost 2 years
i have a webpage which is housing my iFrame which is from a different domain. Now i have a button inside the iFrame which when pressed, needs to refresh or reload the iframe.
I've tried a few methods which are blocked due to cross domain attempts..
-
nnnnnn almost 11 yearsWhat actually have you tried? Is the button calling JS code included within the iframe's document?
-
Bergi almost 11 years
window.location.reload()
? -
quantoid almost 6 yearsI disagree that this question is a duplicate of stackoverflow.com/questions/2064850/… because this question is specifically about reloading from the document within the iframe, whereas that other question is about reloading from the parent document containing the iframe.
-
-
Realto619 almost 10 yearsWorked for me on a similar problem where I had a form in the same domain in an iframe that wasn't reloading right in IE 11 and I had been working on it for over an hour when I saw this and I had a Eureka! moment (well, okay, it wasn't quite THAT dramatic, but it was a bright spot in an otherwise dull Monday at work)
-
jessier3 almost 8 yearsThis worked for me reloading an iframe from inside the iframe.