[英]Issue loading external files (CSS and JavaScript) in Safari
I'm having a bizarre situation here where my external site files, both JavaScript and CSS, are being interpretted as somehow corrupt on Safari browsers. 我在这里有一个奇怪的情况,我的外部网站文件,包括JavaScript和CSS,被解释为在Safari浏览器上以某种方式损坏。 The same site looks fine in Internet Explorer, but on Safari the javascript and css are being completely ignored.
同样的网站在Internet Explorer中看起来很好,但在Safari上,javascript和css被完全忽略了。 If I look at the files through the Inspector, I can see that Safari views these files as containing junk characters -- either asian symbols or square boxes.
如果我通过Inspector查看文件,我可以看到Safari将这些文件视为包含垃圾字符 - 亚洲符号或方框。 When I navigate directly to the files, however, they appear just fine.
但是,当我直接导航到文件时,它们看起来很好。 See the site below, viewed in Safari 5, for an example:
有关示例,请参阅下面的站点,在Safari 5中查看:
http://amsoell.com/dch/castlemoore http://amsoell.com/dch/castlemoore
If I embed the same exact CSS or JavaScript into the HTML itself, it renders perfectly. 如果我将相同的CSS或JavaScript嵌入HTML本身,它会完美呈现。 I don't know if this is a server issue or something in my CSS, but I'm at my wits end here.
我不知道这是一个服务器问题还是我的CSS中的东西,但我在这里结束了我的智慧。
I checked your website for validation and it's not valid. 我检查了您的网站以进行验证 ,但它无效。 But the most interesting thing is that your enconding is
utf-16le
. 但最有趣的是,你的意思是
utf-16le
。 You should put your encoding to utf-8
. 你应该把你的编码放到
utf-8
。 Just put the following line in your <head>
section: 只需在
<head>
部分中添加以下行:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Include the charset="utf-8"
parameter in your <script>
and <link>
tags: 在
<script>
和<link>
标记中包含charset="utf-8"
参数:
<script type="text/javascript" charset="utf-8" src="script.js"></script>
<link rel="stylesheet" type="text/css" charset="utf-8" href="style.css">
通过在“ Windows-1252编码 ”中保存html页面可以解决该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.