未捕获的类型错误:无法读取IE和Chrome Firefox中未定义的属性“文档”很好

Uncaught TypeError: Cannot read property 'document' of undefined in IE and Chrome Firefox is fine

本文关键字:未定义 Firefox Chrome 属性 很好 文档 IE 类型 错误 读取      更新时间:2023-09-26

我遇到了一个我不明白的奇怪错误。在Firefox 11中,一切都很好。Chrome 和 IE 9 正在制造麻烦,并为此行给出相同的错误:

捕获的类型错误:无法读取未定义的属性"文档"

 curr_url_id=window.content.document.location.href;

有什么帮助吗?

试试window.location.href .

如果您确实尝试访问 iframe 的位置,请尝试iframe.contentWindow.location.href