Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 928
wael34218 Avatar asked Sep 20 '10 07:09

wael34218


1 Answers

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.

like image 89
Abhishek Amit Avatar answered Oct 03 '22 00:10

Abhishek Amit