Diego Hillesheim
Diego Hillesheim

Reputation: 165

MIME type error with .js in all browser in a view of SharePoint 2013

I have a error when the file .js is loaded, but this error ocurred in all browsers, I try clean the file .js but the error is not in the code, I discovered this error is in header, but I no have idea to how fix this. This erro ocurred only in a view of list of SharePoint 2013.

Error:

Refused to execute script form 'url/.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Upvotes: 2

Views: 8221

Answers (2)

Mahmoud Farahat
Mahmoud Farahat

Reputation: 5475

I had this problem before (because of copying files from different site) and solved by checking out and checking in the files

Upvotes: 1

Danger
Danger

Reputation: 2113

There has been a recent change to at least the Chromium platform to enforce strict MIME type checking. When my Chrome browser updated, my web site suddenly started failing because I had not properly set the MIME types of .js files. Setting the MIME type properly on the server fixed my issue.

The insidious part of this, at least for me, is that there were no warning messages in the browser console when this occurs - my JavaScript will just silently fail to execute.

If you can discover which .js file in your SharePoint distribution is causing the problem, and set it's MIME type properly, that should fix the issue. Might also be a server configuration setting somewhere in the bowels of SharePoint administration.

Upvotes: 2

Related Questions