Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null
Uncaught TypeError: Cannot read properties of null (reading 'insertAdjacentHTML')
感知平台一直抓取到此错误,但是自己本地无法复现抓取,因为这个问题,js错误率居高不下,惆怅~
没找到合适的解决方法,目前采取在本地代码中使用错误过滤,来忽略采集。等后面找到合适方法再更新。
window.onerror = function (msg) {
if (msg.indexOf('insertAdjacentHTML') > -1) {
return true
}
}
window.addEventListener('error', function (e) {
console.log('error', e.message)
if (e && e.message && e.message.indexOf('insertAdjacentHTML') > -1) {
e.preventDefault()
}
}, true)
Vue.config.errorHandler = function (err, instance, info) {
console.log('errHandler enter', err)
if (err.message && err.message.indexOf('insertAdjacentHTML') > -1) {
console.log('err.message::', err.message)
}
// throw err
}
- insertAdjacentHTML TypeError Uncaught property Cannotinsertadjacenthtml typeerror uncaught property properties typeerror undefined uncaught addeventlistener typeerror uncaught property typeerror undefined uncaught property properties typeerror reading cannot typeerror undefined property cannot emitsoptions properties typeerror uncaught resetupscroll typeerror property cannot javascript typeerror uncaught function constructor typeerror uncaught错误