原因: JS报错是由于写法问题或浏览器不兼容导致的,具体解决方法如下:
原来报错的写法:
window.location.href ("https://www.baidu.com/");
正确的写法:
window.location.href = "https://www.baidu.com/";