day12-前端面试技巧-( 错误监控)
2019-03-11 本文已影响6人
东邪_黄药师
前端错误的分类:

错误的捕获方式:


上报错误的基本原理:

<title>错误监控</title>
<script type="text/javascript">
window.addEventListener('error', function (e) {
console.log('捕获', e);
}, false);
</script>
</head>
<body>
<script src="//badu.com/test.js" charset="utf-8"></script>
<script type="text/javascript">
(new Image()).src = 'http://baidu.com/tesjk?r=tksjk';
</script>