preventing" SCRIPT5:访问被拒绝"在IE错误 [英] Preventing "SCRIPT5: Access is denied" error in IE

查看:166
本文介绍了preventing" SCRIPT5:访问被拒绝"在IE错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情景:在A.com有含第B B.com的IFrame第一个。页面B使用jQuery的1.10.1和做的没有的需要和第一个进行沟通。

Scenario: Page A on A.com that has an IFrame containing Page B on B.com. Page B uses jQuery 1.10.1 and does not need to communicate with Page A.

不管这个事实,在IE9和IE10,jQuery的生成SCRIPT5:访问被拒绝。错误的,看似拒绝执行任何的jQuery的。我有没有必要的跨域通信,AJAX请求,等等,但我确实需要jQuery的加载和没有错误的网页B执行。

Regardless of this fact, in IE9 and IE10, jQuery generates a "SCRIPT5: Access is denied." error and seemingly refuses to execute any jQuery at all. I have no need of cross-domain communication, AJAX requests, etc., but I do need jQuery to load and execute without errors in Page B.

有没有一种方法,以prevent出现(和抑制code执行)在IE9和IE10这个错误? (仅供参考,其他浏览器同样产生访问被拒绝的错误,但不妨碍code执行)

Is there a way to prevent this error from appearing (and inhibiting code execution) in IE9 and IE10? (FYI, other browsers similarly generate "access denied" errors, but they do not hinder code execution)

更新:

的jsfiddle: http://jsfiddle.net/86q5k/4/

jsFiddle: http://jsfiddle.net/86q5k/4/

主机页的内容(来自的jsfiddle):

The contents of the host page are (from the jsFiddle):

<iframe src="http://endorkins.com/test-iframe.html"></iframe>

在iFramed页的内容是:

The contents of the iFramed page are:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            console.log('Hello!  Congratulations.  Your browser is neat, and doesn\'t sniff glue! (http://bit.ly/12QTvTT)');
        });
    </script>
</head>
    <body>
    </body>
</html>

在Chrome浏览器(注意:在控制台消息)结果:

Result in Chrome (Notice the message in the console):

在IE 9.0.8112(注意遗漏的消息在控制台)结果:

Result in IE 9.0.8112 (Notice the omission of the message in the console):

推荐答案

我找到了一个解决办法。这似乎是一个错误(功能?)jQuery中1.10.1。使用jQuery 1.10.0中,不再出现错误:

I found a workaround. This appears to be a bug ("feature"?) in jQuery 1.10.1. Using jQuery 1.10.0, the error no longer occurs:

http://jsfiddle.net/86q5k/5/

<iframe src="http://endorkins.com/test-iframe-1.10.0.html"></iframe>

奇怪。很奇怪。如果有人知道为什么这是发生在1.10.1,以及如何解决它,我(和世界各地的jQuery的爪牙)肯定会非常有兴趣知道! :)

Strange. Very strange. If anyone knows the reason why this is happening in 1.10.1, and how to fix it, I (and jQuery minions around the globe) would certainly be very interested to know! :)

更新:看起来这是一个合法的jQuery 1.10.1错误: http://bugs.jquery.com/ticket/13980

UPDATE: Looks like this is a legit jQuery 1.10.1 bug: http://bugs.jquery.com/ticket/13980

更新:据@埃马努埃莱 - 希腊,这将固定在1.10.2以上。因此,在升级的jQuery的版本可能会解决这个问题。

UPDATE: According to @emanuele-greco, this is fixed in 1.10.2 and up. So, upgrading your version of jQuery will likely fix the problem.

这篇关于preventing&QUOT; SCRIPT5:访问被拒绝&QUOT;在IE错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆