Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey there, I have been trying too figure out how to open javascript popup windows in a c# web browser for the past two days, can someone please explain to me, how to stop c# pop ups from escaping from the c# webbrowser and opening up in my default browser, internet explorer.

I will be very grateful ;)
Thanks
John
Posted

1 solution

I am not really sure if that is what you want, but I successfully suppressed pop-ups with the following:
C#
public Form2()
{
    InitializeComponent();
    webBrowser1.NewWindow += new CancelEventHandler(webBrowser1_NewWindow);
}
void webBrowser1_NewWindow(object sender, CancelEventArgs e)
{
    e.Cancel = true;
}


Hope it helps,
cheers
Andy
 
Share this answer
 
Comments
johnmayt 13-Oct-11 17:02pm    
Hi Andy

Thanks alot for your code.
I am not trying to suppress the popup window, I am trying to load it.
Unfortunately your code did not work.

Thanks alot anyway
Regards
John

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900