wael34218
wael34218

Reputation: 4930

Cant access values inside my iFrame it gives me permission denied

I cant access values inside my iFrame it gives me permission denied. I have access on both pages (parent and child).

I added the following javascript line on both pages:

document.domain = "sub.domain.com";

but firebug gives me : Illegal document.domain value

and when i try to access element inside the iFrame it prompts : Permission denied for http://sub1.domain1.com to call method Location.toString on http://sub2.domain2.com

Thanks

Upvotes: 5

Views: 7516

Answers (3)

Abhishek Amit
Abhishek Amit

Reputation: 304

You can only set document.domain to a superdomain of the pages actual domain, not an entirely different one (https://developer.mozilla.org/en/DOM/document.domain). So if you set up 1.sub.domain.com and 2.sub.domain.com you should be able to set document.domain on both of them to sub.domain.com and that should work.

Upvotes: 7

letronje
letronje

Reputation: 9148

Some hacks for Cross domain communication with iframes ~> http://softwareas.com/cross-domain-communication-with-iframes

Upvotes: 0

Yves M.
Yves M.

Reputation: 3318

Cross-Domain Scripting is not allowed. http://en.wikipedia.org/wiki/Cross-site_scripting

Not working:

http://sub1.domain1.com
http://sub2.domain2.com

Working:

http://sub1.domain1.com
http://sub2.domain1.com

Upvotes: 0

Related Questions