隐藏alert和confirm弹出框的IP

匿名 (未验证) 提交于 2019-12-03 00:39:02
//重写alert window.alert = function(name){     var iframe = document.createElement("IFRAME");     iframe.style.display="none";     iframe.setAttribute("src", 'data:text/plain,');     document.documentElement.appendChild(iframe);     window.frames[0].window.alert(name);     iframe.parentNode.removeChild(iframe); } //重写confirm 不显示ip地址   var wConfirm = window.confirm;   window.confirm = function (message) {       try {           var iframe = document.createElement("IFRAME");           iframe.style.display = "none";           iframe.setAttribute("src", 'data:text/plain,');           document.documentElement.appendChild(iframe);           var alertFrame = window.frames[0];           var iwindow = alertFrame.window;           if (iwindow == undefined) {               iwindow = alertFrame.contentWindow;           }           var result = iwindow.confirm(message);           iframe.parentNode.removeChild(iframe);           return result;       }       catch (exc) {           return wConfirm(message);       }   }
去除 alert、confirm 顶部ip的方法
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!