通过com/tag/255/" title="查看含有 https 标签的文章" target="_blank">https://www.ibytx.com/tag/1746/" title="查看含有 chrome 标签的文章" target="_blank">chrome浏览器开发者工具我们可以很轻松的调试js代码,比如js计算两个日期之间相差多少天函数:
文件进行测试的方法" src="https://www.ibytx.com/wp-content/uploads/2020/12/20201204_5fca11c04e182.png" style="width: 797px; height: 319px;" alt5="Chrome浏览器开发者工具中引入网络js文件进行测试的方法" alt="Chrome浏览器开发者工具中引入网络js文件进行测试的方法" />
那么如果我们需要调试更复杂的js代码要怎么办呢?下面就是在Chrome控制台中引用网络js文件的方法:
chrome 浏览器 console 控台引入外部 js 文件如
https://cdn.bootcss.com/sockjs-client/1.3.0/sockjs.min.js
在 console 中输入:
var script = document.createElement('script'); script.src = "https://cdn.bootcss.com/sockjs-client/1.3.0/sockjs.min.js"; document.getElementsByTagName('head')[0].appendChild(script);
则在控制台中引入 sockjs.min.js 文件成功

博悦天下










