//重写alert方法 防止提示消息时,泄漏服务器ip地址 据说ie不支持,未验证
window.alert = function alertw(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);
}
window.alert = function alertw(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);
}
本文介绍了一种重写浏览器alert方法的技术方案,目的是避免在显示警告信息时泄露服务器IP地址等敏感信息。该方法通过创建一个隐藏的iframe元素,并利用其内部窗口对象来实现alert功能。
1万+

被折叠的 条评论
为什么被折叠?



