Access is denied. on jquery.form.js in IE

扶醉桌前 提交于 2019-12-10 15:35:48

问题


How do I resolve this problem? Access denied on IE:(jquery.form.js)

 =>   if (io.contentWindow.document.execCommand) {
        try { // #214
            io.contentWindow.document.execCommand('Stop');
        } catch(ignore) {}
    }

回答1:


I was hit by the same problem today.

However this issue has been documented

The problem is that the code is broken in IE9. On of the commenters from the link explains the problem:

This happens because of the IE "friendly error messages" "feature". For HTTP 4xx and 5xx responses IE replaces the content of the IFRAME with its friendly error message and in so doing changes the domain of the frame. When the plugin tries to access the response document it fails due to the same-origin policy, which causes the plugin to treat the request as aborted

Due to this security restriction the IE js interpreter barfs a security exception from the moment io.contentWindow.document is accessed.

quick fix/hack (moved if call inside try block):

try { // #214
  if (io.contentWindow.document.execCommand) 
   io.contentWindow.document.execCommand('Stop');
} catch (ignore) { }

I have this fix in production and I did not find any negative side effects in IE8/IE9




回答2:


Based on the minimal information you've provided, it sounds like you're trying to use JavaScript in one window to access a window from a different origin. You can't do that, it's not allowed by the Same Origin Policy. The only way to "resolve" it is to do something else instead.



来源:https://stackoverflow.com/questions/12933868/access-is-denied-on-jquery-form-js-in-ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!