SCRIPT5:由于jQuery.min CDN文件在Wordpress中IE9导致访问被拒绝 [英] SCRIPT5: Access Denied on IE9 due to jQuery.min CDN file in Wordpress

查看:277
本文介绍了SCRIPT5:由于jQuery.min CDN文件在Wordpress中IE9导致访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了很多关于SCRIPT5的其他文章:访问被拒绝在IE9中的问题,但据我所知,这是一个有点不同,我不知道为什么它的发生。

I've read quite a few other articles on the SCRIPT5: Access is Denied issue in IE9 but as far as I can tell this one is a little different and I'm not exactly sure why its happening.

在使用标准2011主题的Wordpress 3.4.1安装中出现了这种情况。我排队我的脚本具有以下功能:

The situation arose on a Wordpress 3.4.1 install using the standard 2011 theme. I enqueued my scripts with the following function:

function my_scripts(){
    wp_deregister_script('jquery');
    wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js',null,null,true);
    wp_register_script('cycle', 'http://ajax.microsoft.com/ajax/jquery.cycle/2.88/jquery.cycle.all.js',null,null,true);
    wp_register_script('plugin', get_stylesheet_directory_uri() . '/scripts/plugin-init.js',null,null,true);
    wp_enqueue_script('jquery');
    wp_enqueue_script('cycle');
    wp_enqueue_script('plugin');
}

首先,$ code> jquery 而$ code>循环插件脚本是空的,除了单个元素上的基本循环调用。

First the jquery and the cycle scripts are both being pulled from CDNs. The plugin script is empty with the exception of a basic cycle call on a single element.

在这一点上,除了IE9之外,所有浏览器都能正常工作。我收到以下错误:

At this point all browsers worked fine with the exception of IE9. I received the following error:

 SCRIPT5: Access is denied
 jquery.min.js, line 2 character 68522 

我发现这是一个十字架问题:

I found out quickly enough that this was a cross origin issue:

访问被拒绝在IE上的jQuery脚本

SCRIPT5: IE9中的访问被拒绝在xmlhttprequest上

我发现这是奇怪的,因为我的插件中没有交叉起始的功能。此外,问题出现在 jquery 本身,而不是我的代码。尝试了几个建议的修复,但没有运气。

I found this odd since there were no cross origin functions in my plugins. Also the issue was showing up on jquery itself and not my code. Tried several suggested fixes but had no luck.

尝试了一些基本的东西。将脚本直接移动到页脚中。试图将其直接移动到标题中。试图将我的脚本从方程式中删除。在这一点上拉我的头发。

Tried some basic stuff. Moved the script directly into the footer. Tried moving it directly into the header. Tried cutting my scripts out of the equation. Pulling my hair out at this point.

我最好的打算是实际看到导致错误的代码(因为我不能在细化版)。在这一点上,代码直接在标题中,从脚本中删除了 .min ,刷新了,TA-DA:一切都正常工作。

My best bet was going to be to actually see what was causing the error in the code (since I couldn't on the minified version). At this point the code was directly in the header so removed the .min from the script, did a refresh, and TA-DA: Everything is now working without a hitch.

如果我尝试使用 my_scripts()函数> wp_register_script & wp_enqueue_script 它会再次失败。如果我尝试将未命名的脚本声明移动到页脚中,那么它将再次失败。当时我没有测试本地副本,只有CDN版本。

If I try to move the unminified script declaration back to the my_scripts() function using wp_register_script & wp_enqueue_script it will fail again. If I try to move the unminified script declaration into the footer it will fail again. I did not test a local copy at the time, only the CDN versions.

这是相同的SCRIPT5错误,但我不幸的是没有代码,错误是从方便生成。这是在另一天在办公室,我在周末休息。我试图在我的个人沙箱上复制这些事件,但是在重新创建错误方面没有成功,这导致我认为不公开的内容可能是罪魁祸首。

It's the same SCRIPT5 error but I unfortunately don't have the code the error is generating from handy. This was at the office the other day and I'm off for the weekend. I attempted to reproduce the events on my personal sandbox but was unsuccessful in recreating the error, which leads me to believe something unlisted may be the culprit.

有没有人有任何想法这里发生了什么?为什么 jquery.min 失败,未分类文件不会?为什么未定义的文件会继续失败,除非它直接在< head> 中?

Does anyone have any idea what's going on here? Why would jquery.min fail where the unminified file would not? And why would the unminified file continue to fail unless its directly in the <head>?

很高兴提供更多的信息,虽然有些可能需要等到我下周才能上班。一旦我能够尝试得到其余的代码发布。

Happy to supply more information, although some of it may have to wait until I return to work this coming week. As soon as I'm able I will try to get the rest of the code posted.

推荐答案

我有同样的问题, jQuery 1.8.1为我解决了这个问题

i had the same problem, jQuery 1.8.1 fixed this problem for me

这篇关于SCRIPT5:由于jQuery.min CDN文件在Wordpress中IE9导致访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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