简体   繁体   中英

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. The same site looks fine in Internet Explorer, but on Safari the javascript and css are being completely ignored. 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. When I navigate directly to the files, however, they appear just fine. See the site below, viewed in Safari 5, for an example:

http://amsoell.com/dch/castlemoore

If I embed the same exact CSS or JavaScript into the HTML itself, it renders perfectly. I don't know if this is a server issue or something in my CSS, but I'm at my wits end here.

I checked your website for validation and it's not valid. But the most interesting thing is that your enconding is utf-16le . You should put your encoding to utf-8 . Just put the following line in your <head> section:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 

Include the charset="utf-8" parameter in your <script> and <link> tags:

<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页面可以解决该问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM