且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2021-08-09 03:48:53

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

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.

如果您想变得更有趣,您可以检查页面是否安全,然后选择链接的安全版本或非安全版本.如果您需要,我可以发布一个样本.

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.

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

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

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

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