比如说 window.alert = function(){}

这样的话我们想用弹窗的话就会失效了..

如果还想用的话具体解决方法有二种

第一种:

自己家的不行了就去别人家借一个..

window.alert = function(){}

function alert(str){
    var iframe = document.createElement('iframe');
    document.body.appendChild(iframe)
    iframe.contentWindow.alert(str)
}

第二种(推荐):

只是覆盖了方法,去他老家找他..

window.alert = function(){}

function alert(str){
    window.constructor.prototype.alert.call(window  , str)
}

ok..这就又可以继续用了..

 

相关文章:

  • 2022-02-08
  • 2022-03-01
  • 2021-04-18
  • 2022-12-23
  • 2021-10-14
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-11
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
相关资源
相似解决方案