<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS屏蔽不显示消息弹窗里的来路域名</title>
</head>

<body>
<script type="text/javascript">
var wAlert = window.alert;
window.alert = 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;
}
iwindow.alert(message);
iframe.parentNode.removeChild(iframe);
}
catch (exc) {
return wAlert(message);
}
}
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);
}
}
</script>
<script>alert('操作成功!此窗口没有来路域名显示了!');</script>
</body>

</html>