如何在HTTPS服务器上托管我的CSS / JS [英] How can I host my CSS/JS on an HTTPS server

查看:504
本文介绍了如何在HTTPS服务器上托管我的CSS / JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Chrome中加载自定义CSS时遇到问题。我使用的是Joomla Artforms。



这里有几个来自chrome的JavaScript控制台语句:



[blocked]页面 https://www.mysite.com/component/artforms/?formid= 200 是通过HTTPS加载的,但从http:// www.mysite.com/includes/js/jscalendar-1.0/calendar_stripped.js运行不安全的内容:此内容也应通过HTTPS加载。 / p>

[blocked]https:// www.mysite.com/component/artforms/?formid=200的网页是通过HTTPS加载的,但运行不安全的内容'http://www.mysite.com/modules/mod_followme/style.css':此内容也应通过HTTPS加载。



请让我知道如果您需要更多详细信息。



感谢

解决方案

正确的是使用URL语法加载外部文件


// example.com/path/to/some/file.js(remote)



/ path / to /some/file.js(local)


这将使用与主HTML相同的协议(HTTP或HTTPS)



请注意,这只有在您的外部资源通过HTTPS可用时才有效。如果不是,那么除了将外部资源移动到支持HTTPS的地方之外,您无法做什么。


I am facing problems with loading my custom CSS in Chrome. I'm using Joomla Artforms.

Here are few Javascript console statements from chrome:

[blocked] The page at 'https://www.mysite.com/component/artforms/?formid=200' was loaded over HTTPS, but ran insecure content from 'http:// www.mysite.com/includes/js/jscalendar-1.0/calendar_stripped.js': this content should also be loaded over HTTPS.

[blocked] The page at 'https:// www.mysite.com/component/artforms/?formid=200' was loaded over HTTPS, but ran insecure content from 'http: //www.mysite.com/modules/mod_followme/style.css': this content should also be loaded over HTTPS.

Please let me know if you need more detail.

Thanks

解决方案

Simplest way to get this right is to load external files using the URL syntax

//example.com/path/to/some/file.js (remote)

or

/path/to/some/file.js (local)

This will load your resource using the same protocol (HTTP or HTTPS) as your main HTML page.

Note though that this will only work if your external resource is available over HTTPS. If it isn't then there's nothing you can do except move the external resource somewhere that does support HTTPS.

这篇关于如何在HTTPS服务器上托管我的CSS / JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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