views:

105

answers:

3

so all these time i had no problem with this script. all of sudden today, it began to behave strangely.

so i have a javascript page that loads inside iframe.

this is injected into a page loaded via proxy.

$(top.document).ready(), throws error saying Permission denied...

i was surprised so, i decided to try load a different page.

then it is no longer complaining.

i reboot my computer, and when i first load a page via proxy, as the iframe containing javascript is injected into that page, i get the same error again.

what is happening? is this a problem on my server or my computer?

+6  A: 

http://en.wikipedia.org/wiki/Same_origin_policy

brianreavis
Yup, this is almost certainly it. Also, the answer below indicates that the session ID is different, which probably means that the two pages are being served by different virtual hosts (e.g. example.com and www.example.com).
Daniel Pryden
+2  A: 

As the error says, there is a permissions problem and it likely has nothing to do with an error your computer, server, or otherwise, but is a design limitation/security feature of JavaScript.

JavaScript is able to access and/or alter other documents (e.g.: windows) other than its own (the one it is being executed fro) if that document comes from the same host. This is known as the "same origin policy."

Justin Johnson
A: 

but i dont understand why its working on and off. it shouldn't work at all as you say.\

my suspicion is something to do with the javascript page being loaded via iframe....

because the session id in the page inside iframe and outside are different....