Disable Chrome strict MIME type checking
The server should respond with the correct MIME Type for JSONP application/javascript
and your request should tell jQuery you are loading JSONP dataType: 'jsonp'
Please see this answer for further details !You can also have a look a this one as it explains why loading .js
file with text/plain
won't work.
In my case, I turned off X-Content-Type-Options
on nginx
then works fine. But make sure this declines your security level a little. Would be a temporally fix.
# Not workadd_header X-Content-Type-Options nosniff;# OK (comment out)#add_header X-Content-Type-Options nosniff;
It'll be the same for apache.
<IfModule mod_headers.c> #Header set X-Content-Type-Options nosniff</IfModule>
For Windows Users :
If this issue occurs on your self hosted server (eg: your custom CDN) and the browser (Chrome) says something like ... ('text/plain') is not executable ...
when trying to load your javascript file ...
Here is what you need to do :
- Open the Registry Editor i.e
Win + R > regedit
- Head over to
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.js
- Check to if the Content Type is
application/javascript
or not - If not, then change it to
application/javascript
and try again