Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to denied open new window in geckofx?

Tags:

c#

geckofx

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?

like image 813
CrazyStack Avatar asked Mar 17 '12 13:03

CrazyStack


1 Answers

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);
}
like image 186
VinaCaptcha Avatar answered Nov 04 '22 07:11

VinaCaptcha