You can not close an alert box, just you can hijack window.alert
window._alert = window.alert;
window.alert = function () {
};
The code would have to appear before the third party library's code. What this means is, if you want to use an alert, you would have to change your code.
One way would to call the method that has the reference
window._alert("hi");
Other way would be to overload the "new" function
window._alert = window.alert;
window.alert = function (msg, showItNow) {
if (showItNow) {
window._alert(msg);
}
};
window.alert("BOOOO!"); //I will not show up
window.alert("hi", true); //I will show up
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…