Strange characters in Javascript causing it to not load
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My site works fine on localhost, my javascript is loading and working fine. But when I deploy the site the script is not working. When I right click the page and say view source and then view the linked script file, it has some strange characters at the start of the file (function($){ On localhost, my script file starts like this (function($){ What is causing these characters to be prepended to my javascript file? 回答1: You have to re-save the file in encoding "UTF-8 without BOM". You can use Notepad++ or other editors. In visual studio: By