How to easily capture the NewWindow event for the WebBrowser control and detect a JavaScript window.
This article describes a simple method of capturing a NewWindow event for the Windows Forms WebBrowser control, and also how to detect (and potentially cancel) a JavaScript window.close() call.