5

i can't find way to denied open new window when clicking links on webpage. All preferences about popups is not working.

I want to open any clicked links in current window. How can i do that?

CrazyStack
  • 169
  • 2
  • 13

1 Answers1

11

You can use the event CreateWindow to handle a new popup window:

GeckoWebBrowser wb1 = new GeckoWebBrowser();
wb1.CreateWindow += new EventHandler<GeckoCreateWindowEventArgs>(wb1_CreateWindow);

Here event CreateWindow:

void wb1_CreateWindow(object sender, GeckoCreateWindowEventArgs e)
{
    //Keep popup new window here!
    e.Cancel = true;

    //e.WebBrowser.Navigate(e.Uri);

    // OR

    //GeckoWebBrowser wb1 = new GeckoWebBrowser();
    //wb1.Navigating += new EventHandler<GeckoNavigatingEventArgs>(wb1_Navigating);
    //wb1.Dock = DockStyle.Fill;
    //wb1.CreateControl();
    //TabPage tab1 = new TabPage("New WebBrowser");
    //tabBrowser.TabPages.Add(tab1);
    //tab1.Controls.Add(wb1);
    //wb1.Navigate(e.Uri);
}
zx485
  • 28,498
  • 28
  • 50
  • 59
VinaCaptcha
  • 126
  • 2
  • 3