html页面跳转问题:.js脚本加载失败报错
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 = "../../../";有问题
<script type="text/javascript" src="./js/mallIndex.js"></script>
解决:
mallindex.js,跳转层次多一层
window.rootpath = "../../";