Alex K
Alex K

Reputation: 25

JS charset error in browser

I've bumped into a weird problem. When I'm editing a .js document, I'm getting error "SyntaxError: illegal character".

Here is the part of the document. I've just added alert(1); as you can see:

Relevant Part of the Document

Here is how it shows in my browser (note that these symbols at the end of the document):

How It Shows in My Browser

About document: charset UTF-8, line breaks CRLF.

I'm using Firefox on Ubuntu. Headers from the local server:

Accept-Ranges: bytes
Connection: close
Content-Length: 56871
Content-Type: application/x-javascript
Date: Wed, 10 Feb 2016 15:15:05 GMT
Etag: "6d-de27-c52b5640"
Last-Modified: Wed, 10 Feb 2016 15:05:53 GMT
Server: Apache/2.2.3 (CentOS)

I tried to change Content-Type to application/javascript, tried to edit in different editors, tried to remove BOM -- the same result.

UPD: I don't know why but it works when I reload local server! (I use vagrant with centos installed). I tried to reload just apache - still error. UPD 2: mime-types for .js files on local server are text/x-c or text/x-c++ meanwhile it's text/plain on host machine

Upvotes: 1

Views: 107

Answers (2)

Alex K
Alex K

Reputation: 25

I've found the solution of the problem. I've added EnableSendfile Off to my .htaccess. For more information follow the link

Upvotes: 1

Yasin Fatullayev
Yasin Fatullayev

Reputation: 169

put comma ',' after variable order_addresses And if you use ajax call to server do not use the Content type

Upvotes: 0

Related Questions