我的 Greasemonkey 脚本损害了 IE9 HTTPS 安全性?

发布于 2024-09-26 14:39:15 字数 493 浏览 1 评论 0原文

我在 IE9 中有一个导入 jQuery 的 Greasemonkey-for-IE 脚本。但在安全页面上它不起作用。

我得到:

SEC7111: HTTPS security is compromised by http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

失败的代码是:

var script = document.createElement("script");
script.setAttribute("src", 
    "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");

我怎样才能使它工作?该脚本不会在 Firefox 中引起问题。

I’ve got a Greasemonkey-for-IE script in IE9 that’s importing jQuery. But on secure pages it doesn’t work.

I’m getting:

SEC7111: HTTPS security is compromised by http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

The code that fails is:

var script = document.createElement("script");
script.setAttribute("src", 
    "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");

How can I make this work? The script doesn’t cause a problem in Firefox.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

滥情哥ㄟ 2024-10-03 14:39:15

您可以通过使用与方案相关的 URL,通过更简单的代码来消除该问题,如下所示:

var script = document.createElement("script");
script.setAttribute("src", 
   "//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");

这将在 http:// 页面上使用 http:// ,并且 https://https:// 页面上...解决问题的更简单方法。

You can eliminate the issue with simpler code by using a scheme-relative URL like this:

var script = document.createElement("script");
script.setAttribute("src", 
   "//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");

This will use http:// on an http:// page and https:// on an https:// page...a much simpler way to solve the issue.

暖阳 2024-10-03 14:39:15

大概:使用 https://ajax.googleapis.com/ ajax/libs/jquery/1.4.2/jquery.min.js 改为(或不信任第三方 CDN(既值得信赖又不会受到损害)的安全页面)

Presumably: Use https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js instead (or not trust a third party CDN (to be both trustworthy and not compromised) for your secure pages)

野味少女 2024-10-03 14:39:15

该错误消息是 IE 针对混合内容(安全页面上的 HTTP 和 HTTPS 资源)发出警告的新方式。 此处 是相关的 MSDN 博客文章。

使用

https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js

似乎也有效,尽管我在 库 API 概述。

The error message is IE's new way of warning about mixed content (HTTP and HTTPS resources on a secure page). Here is a related MSDN blog post.

Using

https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js

seems to work as well, although I can't see a official reference to it in the Libraries API overview.

蒲公英的约定 2024-10-03 14:39:15

问题是,当您处于安全模式(即 HTTPS)时,页面加载的所有文件也必须是 HTTPS。您在这里制作的 JQuery 包含是 HTTP。

您需要检测页面是处于 HTTP 还是 HTTPS 模式(使用 window.location.protocol()),并调整 JQuery include 的 URL 以适应。 (它所需要的只是“http”后面附加的“s”)

The problem is that when you're in secure mode (ie HTTPS), all the files loaded by the page must also be HTTPS. The JQuery include you're making here is HTTP.

You need to detect whether the page is in HTTP or HTTPS mode (use window.location.protocol()), and adjust the URL of the JQuery include to suit. (all it needs is the additional 's' after 'http')

人事已非 2024-10-03 14:39:15

您正在使用 https 连接并且想要访问 http 连接。

you are using https connection and you want to access a http connection.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文