【发布时间】:2013-05-28 19:58:09
【问题描述】:
我正在为IFrame 开发一个社交网络应用程序。该应用在 Google Chrome 和 Microsoft Firefox 浏览器中运行良好,但在 Opera 12.15 JQuery 库 v1.10.1 中无法加载,并在 1513 行出现安全错误Unhandled error: Security error: attempted to read protected variable。
截图在这里:
Internet Explorer 10 中似乎存在相同的错误。
如何处理?
更新:
我通过在jquery 的代码中注释 1513-1517 行来进行肮脏的破解:
// Support: IE>8
// If iframe document is assigned to "document" variable and if iframe has been reloaded,
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
/*if ( parent && parent.frameElement ) {
parent.attachEvent( "onbeforeunload", function() {
setDocument();
});
}*/
我的应用程序的功能现在似乎可以工作了,也许有必要在 JQuery 存储库中创建问题...
【问题讨论】:
-
iframe是否从同一个域加载内容? -
@akonsu 不是,来自不同的
-
也许这就是原因。尝试在使用相同域时访问它,看看它是否有效。
-
@akonsu 但是 FF 和 Chrome 工作得很好......
-
@akonsu 但我的应用程序在另一个域上,它正在加载到社交网络的 iframe 中
标签: javascript jquery internet-explorer opera