jov*_*van 5 css https internet-explorer google-chrome
在我的网站上,如果使用https打开页面,则Chrome无法加载样式表.
例如,在页面test.php上我有以下CSS包括:
<link href="http://www.domain.com/css/mainstyle.css" rel="stylesheet" type="text/css">
Run Code Online (Sandbox Code Playgroud)
它使用绝对路径,因为有很多SEO,子目录等,所以像这样包含它比通过寻找相对路径更容易.
如果我打开页面http://www.domain.com/test.php它工作正常,但如果我打开它作为https://www.domain.com/test.php Chrome拒绝加载样式表!
它适用于Firefox和Safari.我可以理解IE是一个"特殊需求"浏览器,但为什么Chrome会这样做,我该如何解决?
使用https://domain.com/css/mainstyle.css调用CSS文件可以解决问题,但这是否真的有必要?
也许试试Protocol Relative URLs:
<link href ="// www.domain.com/css/mainstyle.css"rel ="stylesheet"type ="text/css">
希望它可以帮助!
| 归档时间: |
|
| 查看次数: |
4539 次 |
| 最近记录: |