Opera和Internet Explorer中的JQuery安全性错误
我正在开发一个适用于IFrame
社交网络应用。 该应用程序在Google Chrome和Microsoft Firefox浏览器中运行良好,但在Opera 12.15中,JQuery库v1.10.1无法加载安全错误Unhandled error: Security error: attempted to read protected variable
在第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(); }); }*/
我的应用程序的function现在似乎工作,也许有必要在JQuery repo中创建问题…
错误报告已创建 – http://bugs.jquery.com/ticket/13980 。 Bug现已修复。
在包含JQuery之前添加它:
var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/)); if (isIE11) { if (typeof window.attachEvent == "undefined" || !window.attachEvent) { window.attachEvent = window.addEventListener; } }
希望它有所帮助,它对我有用。