spring-boot icon indicating copy to clipboard operation
spring-boot copied to clipboard

MIME type ('application/json') is not executable, and strict MIME type checking is enabled

Open PBondugula opened this issue 10 years ago • 4 comments

Hi Team,

I have recently migrated the spring boot version from '1.3.2.RELEASE' to ‘1.4.0.RELEASE', while loading the JSP I am getting the below error in Chrome (version: Version 52.0.2743.116 m)

/jscript/jquery.js' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
/jscript /jquery.dataTables.js' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
GET http://localhost:8080/std/jscript/jquery-ui.js 
GET http://localhost:8080/std/jscript/jquery-ui.min.js 
List_std:51 Uncaught ReferenceError: $ is not defined

End point has the following annotation :

@RequestMapping(value = "/studnets/all" ,method = RequestMethod.GET, headers = "Accept=application/json", produces =  "application/json" )

It was working fine with '1.3.2.RELEASE’ of spring boot in both Chrome and Firefox browsers. But with ‘1.4.0.RELEASE' it’s working fine in Firefox, not in Chrome. We didn’t set any X-Content-Type-Options options code.

PBondugula avatar Sep 20 '16 14:09 PBondugula

Serving JavaScript as application/json doesn't look right to me and I suspect is what's causing Chrome to complain. I can't tell what's causing the problem from what you've told us thus far. Can you share a sample that reproduces the problem please?

wilkinsona avatar Sep 20 '16 15:09 wilkinsona

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues avatar Sep 27 '16 15:09 spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-projects-issues avatar Oct 04 '16 15:10 spring-projects-issues

FYI - this is probably due to an invalid Content-Type header in the response. JSONP requires the header value application/javascript.

mikeloll avatar Nov 29 '18 16:11 mikeloll