because its MIME type (‘text/html‘) is not a supported stylesheet MIME type, and strict MIME checkin

html页面跳转问题:.js脚本加载失败报错

because its MIME type (‘text/html‘) is not a supported stylesheet MIME type, and strict MIME checkin_第1张图片

mallOrderEdit.html:1 Refused to execute script from 'http://localhost:63342/xss/mall/js/mallIndex.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

 分析

先排除配置是路径是否是错:

mallindex.js配置根路径

if (window["rootpath"] == null) window.rootpath = "../../../"; //用于页面跳转

当前页面引用 ,如果当前页面要跳转到其他页面时,需要rootpath,跳转失败是因为window.rootpath = "../../../";有问题

解决:

mallindex.js,跳转层次多一层

window.rootpath = "../../"; 

你可能感兴趣的:(前端,javascript,开发语言)