开发者

javascript calling info

开发者 https://www.devze.com 2023-03-27 12:23 出处:网络
I c开发者_StackOverflowreated a facebook fanpage(iframe) application. I would like to fetch the addressbar information from the fanpage iframe.

I c开发者_StackOverflowreated a facebook fanpage(iframe) application. I would like to fetch the addressbar information from the fanpage iframe.

I tried alert(top.location.href) from fanpage iframe application, but nothing happens.

If i use top.location.href = www.google.com then it works, but if I just use alert(top.location.href) nothing happens.

This must mean that it is writable but not readable.

How can I solve this?


This is because of the Same Origin Policy. You can't access data from a different domain. Trying to do so throws a "Permission Denied" error. If top.location.host != location.host, you cannot access its data.


It's a problem with Chrome, according to CodeGuru.

Running this locally wont work either, have you tried on a webserver?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号