屏蔽js弹窗的方法
在html的头部最上方改变alert的‘定义’:
如下代码:
[pcsh lang=”js” tab_size=”4” message=”” hl_lines=”” provider=”manual”]
<script type="text/javascript">
window.alert = function (e) {
if( typeof(e) != 'undefined') {
console.log(e)
}else{
console.log('无提示信息')
}
};
</script>
[/pcsh]
这样alert信息就会显示在console中了
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Dev!