Javascript 警告:页面 index.html 运行了不安全的内容

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7309013/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 01:43:24  来源:igfitidea点击:

Warning : The page index.html ran insecure content

javascripthtmlgoogle-app-enginedojo

提问by user376112

I deployed my application on google appe engine. My web site use Dojo with the template claro. When I run "google chrome inspection", I see a lot of warning when I navigate throught my site. Here is the type of warnings :

我在 google appe 引擎上部署了我的应用程序。我的网站使用带有模板 claro 的 Dojo。当我运行“谷歌浏览器检查”时,我在浏览我的网站时看到很多警告。这是警告的类型:

The page index.html ran insecure content from http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css.
The page index.html ran insecure content from http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js.

Do I need to configurate something in the appengine-web.xml or web.xml?

我需要在 appengine-web.xml 或 web.xml 中配置一些东西吗?

回答by Alan Moore

If your page is always accessed by secure url (https) then you might try accessing the secure versions of those include files. I think you can just use https: in place of http: in the url for those two files.

如果您的页面总是通过安全 url (https) 访问,那么您可以尝试访问这些包含文件的安全版本。我认为您可以在这两个文件的 url 中使用 https: 代替 http: 。

If you want to get fancy, you can check to see if the page is secure and pick either the secure or non-secure version of the link. I can post a sample of that if you need it.

如果您想花哨,您可以检查页面是否安全,然后选择链接的安全或非安全版本。如果你需要它,我可以发布一个样本。

Addendum: To save people time, I am posting @mercator's superior solution here:

附录:为了节省人们的时间,我在这里发布@mercator 的卓越解决方案:

No need to get fancy. If you want to pick the secure or non-secure version depending on whether your own site is secure, you can use a protocol-relative link. E.g. //ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js

没必要花哨。如果您想根据您自己的站点是否安全来选择安全或非安全版本,您可以使用协议相关链接。例如 //ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js

回答by wei

what if the site doesn't support https?? For instance, I'm sending the request to world bank, which only supports http?

如果网站不支持https怎么办??例如,我将请求发送到仅支持 http 的世界银行?

EDIT: on chrome, click the "shield" icon on the right of the address bar.

编辑:在 chrome 上,单击地址栏右侧的“盾牌”图标。

回答by Igor Artamonov

Chrome Inspection validates only client side code, not server side. So, server configuration in appengine-web.xml/web.xmldoesn't matter here.

Chrome 检查仅验证客户端代码,而不验证服务器端。因此,appengine-web.xml/web.xml中的服务器配置在这里无关紧要。

At this case it says that your html is using some external code, from other sites, that can be insecure. It not a big problem, btw. But if you wish, you can copy this files (claro.cssand dojo.xd.js) to your own site to fix this issue.

在这种情况下,它表示您的 html 正在使用一些来自其他站点的外部代码,这可能是不安全的。这不是一个大问题,顺便说一句。但是,如果您愿意,可以将此文件(claro.cssdojo.xd.js)复制到您自己的站点以解决此问题。