3

I'm trying to access to the URL of the parent window from an iFrame but I got an error on my server:

Unsafe JavaScript attempt to access frame with URL http://www.domain.com/folder/ from frame with URL http://www.domain.com/folder/file.html. The frame being accessed set 'document.domain' to 'domain.com', but the frame requesting access did not. Both must set 'document.domain' to the same value to allow access.

I'm in the same domain so I don't understand why I get this error. For your information everything works good in localhost.

Thanks for your help.

1 Answer 1

1

OK I found the solution. I put this code and that works:

document.domain = 'domain.com';
Sign up to request clarification or add additional context in comments.

1 Comment

Where did you add that code? To the first URL (domain.com/folder) or the second ( domain.com/folder/file.html)?

Your Answer

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.