Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebBrowser control: how to suppress message: do you want to close this window

I'm new to WebBrowser control. In the current project, we use WebBrowser control to integrate with existing project. All popup windows are displayed in a new windows form. When "javascript window:close" is called on the popup window, the IE instance always prompt: do you want to close this window. We're using WndProce to check WM_Destroy to notify the parent form the ie is about to close which works fine. The only thing we don't like the control is that the message "do you want to close this window". Is there any way to suppress the message?

Any suggestion will be highly appreciated. Thanks.

like image 771
Keping Avatar asked Oct 20 '25 16:10

Keping


1 Answers

Try using either of the following two functions to close the popup:

function closeWindow()
{
    window.opener = self;
    window.close();
}

Or:

function closeWindow()
{
    window.open('', '_self');
    window.close();
}
like image 73
Druid Avatar answered Oct 23 '25 06:10

Druid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!