I'd like to share an interesting result of some simple modifications to Kleinma's brilliant original. This is what I did:
1) I increased tmrPopCheck.Interval from 100 to 1000;
2) I suppressed the line "tmrPopCheck.Stop()" at the Sub "tmrPopCheck_Tick";
3) I replaced the line "If (PopupHandle <> IntPtr.Zero) AndAlso (PopupHandle <> WB.Handle) Then" by "If (PopupHandle <> IntPtr.Zero) AndAlso (PopupHandle <> WB.Handle) AndAlso (PopupHandle <> Me.Handle) Then".
By doing this, every JSAlert (both "onload" and "onclick") is now promptly killed, and the form is not closed.

I have also a question:
What if my page has a JS Confirm pop-up (with OK and Cancel buttons) instead of a simple Alert? How could I give it one or other of these answers programatically? Is that possible?
Thank you very much!