0

I tried to run a line of code as the following:

document.getElementById('frame0').contentDocument.location.reload(true); to force iframe to refresh or reload but I got the error like "permission denied" in firefox. Does anyone know why? and help to offer a solution? Thanks!

asked Jun 23, 2010 at 8:29

2 Answers 2

1

It is probably because of crossdomain issues - looks like your iframes content is from another domain as your mainframe (from which you run your js code). FF is very restrictive concerning crossdomains.

answered Jun 23, 2010 at 8:33
Sign up to request clarification or add additional context in comments.

Comments

0

You can't reload a document that comes from a different hostname, due to the Same origin policy, which applies in all browsers.

You would have to remove the iframe from the page and replace it with a new one:

var iframe= document.getElementById('frame0');
var newiframe= document.createElement('iframe');
newiframe.src= iframe.src;
iframe.parentNode.replaceChild(newiframe, iframe);

However this will load the original src of the <iframe>, which won't be the same as the current location if the user has navigated the page since.

answered Jun 23, 2010 at 8:50

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.