簡體   English   中英

附加到javascript文件的非法字符

[英]Illegal Characters appended to javascript file

我認為我的apache網絡服務器有問題。 我不能引用jquery.js

我收到以下錯誤:

使用chrome:

Uncaught SyntaxError: Unexpected token ILLEGAL

用firefox:

Error: illegal character
Source File: http://xxxxxxxxx/test/javascript/jquery.js
Line: 1
Source Code:
�Hz�ÚH[9�R

下面是我的測試html代碼

<html>
<head>
    <script type="text/javascript" src="javascript/jquery.js"></script>
    <script type="text/javascript">
        function doclick(){
            jQuery('#hello').attr('value', "mmmmef")
        }
    </script>
</head>
<body>
    <input type="button" name="hello" id="hello" value="hello" onclick="doclick();" />
</body>
</html>

它不僅發生在jquery.js ,這些非法字符被附加到所有jscss文件中。

我使用ssh登錄並使用vi命令查看這些jscss文件,但沒有這些字符。 但是當我嘗試使用FTP客戶端Filezilla或CuteFTP下載或查看/編輯時,會包含這些非法字符。

我的服務器出了什么問題? 相同的代碼可以在我的本地Windows服務器和另一個centos服務器上運行。

我找到了解決方案

http://www.cyberciti.biz/tips/apache-223-corrupt-file-download-issue.html

只需打開httpd.conf並放在下面的行

            EnableMMAP off
            EnableSendfile off

然后

            # /sbin/service httpd restart

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM