I think my apache webserver has got problem. I can't reference jquery.js
I get the following errors:
With chrome:
Uncaught SyntaxError: Unexpected token ILLEGAL
With firefox:
Error: illegal character
Source File: http://xxxxxxxxx/test/javascript/jquery.js
Line: 1
Source Code:
�Hz�ÚH[9�R
Below is my test html code
<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>
It is not only happening to jquery.js
, these illegal characters are being appended to all js
and css
files.
I login with ssh and view these js
and css
files with vi
command, but there are none of these characters. But when I try to download or view/edit with FTP clients Filezilla or CuteFTP, these illegal characters are included.
What's wrong with my server? The same code can run in my local windows server and another centos server.
The “illegal character” error occurs in the compilation phase, so it's quite easy to detect. The next example shows us how it works. Ideally, to fix this problem, the only thing to do is save the file as UTF-8 without BOM encoding. After that, the problem is solved.
The "Illegal characters" exception means that the file path string you are passing to ReadXml is wrong: it is not a valid path. It may contain '?' , or ':' in the wrong place, or '*' for example. You need to look at the value, check what it is, and work out where the illegal character(s) are coming from.
Illegal characters in English are typically punctuation marks or letters that include unusual accent marks. Question marks are commonly illegal characters for naming computer files or folders.
The JavaScript exception "illegal character" occurs when there is an invalid or unexpected token that doesn't belong at this position in the code.
I found the solution at
http://www.cyberciti.biz/tips/apache-223-corrupt-file-download-issue.html
Just open httpd.conf and put below lines
EnableMMAP off
EnableSendfile off
then
# /sbin/service httpd restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With