chrome external files with error invalid token

Does anybody know why Chrome browser shows me my external js files corrupted/unreadble?

enter image description here

I tried to save them without encoding (fail), with UTF-8 (fail), anything else? I’m in linux. Firefox works OK. My php code creates the headers not Apache.

The headers:


GET /cache/js/iuGXtklwZorkyG6kJ2zYlKHf.js HTTP/1.1
Connection: keep-alive
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/66.0.3359.181 Chrome/66.0.3359.181 Safari/537.36
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: authID=d92dde92a9c68261df8e99598a3d6fd3704608ea; g3site=rimjeR11Q4UnUO7AMUuCAYW6pH193b


HTTP/1.1 200 OK
Date: Tue, 12 Jun 2018 09:14:23 GMT
Server: Apache/2.4.18 (Ubuntu)
Cache-Control: no-store, no-cache, must-revalidate, max-age=86400, s-maxage=86400, must-revalidate
Content-Encoding: identity
Pragma: public, cache
Expires: Wed, 13 Jun 2018 09:14:23 GMT
Etag: 72b93c53fee84652c462d792c756f86d
Last-Modified: Tue, 12 Jun 2018 09:13:52 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Access-Control-Allow-Origin: *
Content-Length: 3722
Content-Type: application/javascript

You can see that Firefox behaves perfect:

enter image description here

Chrome says my content script isn’t UTF-8

Receiving the error Could not load file 'worker.js' for content script. It isn't UTF-8 encoded.

> file -I chrome/worker.js
chrome/worker.js: text/plain; charset=utf-8

With to-utf8-unix

> to-utf8-unix chrome/worker.js                                      
Detected charset:
Confidence of charset detection:
Conversion not needed.

I also tried converting the file with Sublime Text back and forth without any luck.


  "content_scripts": [{
      "matches": ["*"],
      "js": ["worker.js"]

The file in question:

It is a compiled javascript file spit out from clojurescript with cljsbuild:

               {:id "chrome-worker"
                :source-paths ["src/chrome/worker"],
                :compiler {:output-to "chrome/worker.js",
                           :optimizations :simple,
                           :pretty-print false}}

Other files (options page, background) are compiled the same way and don’t generate this error. I tried getting rid of weird characters like Emojis but that didn’t fix the problem.

jQuery ajax call can’t decode uft-8 charset from webpage

I’ve previously created a extension for google chrome were I grabbed a chat from a webpage using jquery ajax and displayed a more nicer way within the extension popup. Now, every æ ø å character is displayed with the unicode error �.

I know that both me and the site hasn’t done anything new or changed the charset. They still got their charset defined in the header, and the correct characters is displayed on their page.

Of course I’m using the uft-8 charset on my extension, but this hasn’t been a issue before now..

I’ve tried to define both uft-8 and ISO-8859-1 as content type in my ajax call.. Now i’m getting a bit clueless on this issue. The charset errors only include the chat, everything else is in its current state as it has been from the start.

Screenshot from the extension