views:

50

answers:

2

Hello,
I'm working on a website using extensively javascript. The code I'm working on also rely on other big javascript libs. The thing is that somewhere in these libraries, some alert box are poping.

I was wondering if there are some way to disable the javascript alert box on the fly and re-enable it later.

Thanks

+2  A: 

See this question.

Jaxidian
um, why -1? This is a duplicate of the other question which covers this VERY thoroughly.
Jaxidian
Think duplicates should be posted as comments, as you didn't discovered anything new.
Kamarey
I didn't discover anything new but I didn't claim to. If it was the answer that the questioner is looking for and is flagged as such, it would then help future people who come to this question realize that the other question answers it for them without having to duplicate the content. The goal is to get an answer, not to show off that I'm smart. :-/
Jaxidian
... of course, maybe I just don't understand SO-etiquette (which very well may be the case).
Jaxidian
+1 because I don't think it deserved the -1
David Murdoch
The goal in your case is to get some points on somebody's else answer. You can post it as a comment as did Mark Biek. Removed -1.
Kamarey
Then in that scenario, how does this question get properly flagged as Answered? (I'm not trying to argue, I'm trying to learn. I thought SO preferred to have questions either closed as "not a question" or flagged as answered. If I'm mistaken, please help me here.)
Jaxidian
For what it's worth (not much I suppose), I disagree with you, @Kamarey. Don't vote it *up* if you don't think it's worth much, but a *downvote* means that the answer is *bad*. This is *not* a bad answer.
Pointy
+3  A: 

Save the old alert function, to a variable.

_alert=alert;

And then set the old alert to either null a custom function.

alert=function(){};
/*or*/
alert = null;

To restore the original version of alert simply reverse step 1.

alert=_alert
GameFreak