问题
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