且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用jquery检测iframe src的变化

更新时间:2021-11-16 09:16:56

幸运的是不可能从其他网域获取iframe的网址而不是其父网页。您将无法阅读完整的url。

Fortunately it is not possible to get an URL of an iframe from a different domain than it's parent page. You will not be able to read the full url.

如果您尝试阅读文档位置(其src是不同域的iframe)的文档位置,权限错误,看起来类似于这样的:错误:拒绝获取属性Location.href的权限

If you try to read the documents location (of an iframe whose src is a differnt domain) than you will get a permission error that looks similar to this: "Error: Permission denied to get property Location.href"

这是由于同源策略。更多细节: http://de.wikipedia.org/wiki/Same-Origin-政策

This is due to "Same Origin Policy". More details on that: http://de.wikipedia.org/wiki/Same-Origin-Policy