Navigate() public method

Navigates to the specified URL using the given load flags. In order to find out when Navigate has finished attach a handler to NavigateFinishedNotifier.NavigateFinished.
public Navigate ( string url, GeckoLoadFlags loadFlags ) : bool
url string The url to navigate to. If the url is empty or null, the browser does not navigate and the method returns false.
loadFlags GeckoLoadFlags Flags which specify how the page is loaded.
return bool
示例#1
0
 /// <summary>
 /// Opens a new window which contains the source code for the specified page.
 /// </summary>
 /// <param name="url"></param>
 public void ViewSource(string url)
 {
     Form form = new Form();
     form.Text = "View Source";
     GeckoWebBrowser browser = new GeckoWebBrowser();
     browser.Dock = DockStyle.Fill;
     form.Controls.Add(browser);
     form.Load += (sender, e) => browser.Navigate(String.Format("view-source:{0}", url));
     form.Icon = FindForm().Icon;
     form.ClientSize = this.ClientSize;
     form.StartPosition = FormStartPosition.CenterParent;
     form.Show();
 }
 /// <summary>
 /// Opens a new window which contains the source code for the specified page.
 /// </summary>
 /// <param name="url"></param>
 public void ViewSource(string url)
 {
     //#if GECKO_1_9
     //OpenDialog("chrome://global/content/viewSource.xul", "all,dialog=no", "a", "b", "c");
     //#elif GECKO_1_8
     Form form = new Form();
     form.Text = "View Source";
     GeckoWebBrowser browser = new GeckoWebBrowser();
     browser.Dock = DockStyle.Fill;
     form.Controls.Add(browser);
     form.Load += delegate { browser.Navigate("view-source:" + url); };
     form.Icon = FindForm().Icon;
     form.ClientSize = this.ClientSize;
     form.StartPosition = FormStartPosition.CenterParent;
     form.Show();
     //#endif
 }
示例#3
0
        protected void AddToolbarAndBrowserToTab(TabPage tabPage, GeckoWebBrowser browser)
        {
            TextBox urlbox = new TextBox();
            urlbox.Top = 0;
            urlbox.Width = 200;

            Button nav = new Button();
            nav.Text = "Go";
            nav.Left = 200;

            Button newTab = new Button();
            newTab.Text = "NewTab";
            newTab.Left = 200 + nav.Width;

            Button closeTab = new Button();
            closeTab.Text = "Close";
            closeTab.Left = 200 + nav.Width + newTab.Width;

            Button scrollDown = new Button { Text = "Down", Left = closeTab.Left + 250 };
            Button scrollUp = new Button { Text = "Up", Left = closeTab.Left + 330 };

            scrollDown.Click += (s, e) => { browser.Window.ScrollByPages(1); };
            scrollUp.Click += (s, e) => { browser.Window.ScrollByPages(-1); };

            nav.Click += delegate
            {
                // use javascript to warn if url box is empty.
                if (string.IsNullOrEmpty(urlbox.Text.Trim()))
                    browser.Navigate("javascript:alert('hey try typing a url!');");

                browser.Navigate(urlbox.Text);
                tabPage.Text = urlbox.Text;
            };

            newTab.Click += delegate { AddTab(); };

            closeTab.Click += delegate
            {
                m_tabControl.Controls.Remove(tabPage);
                browser.Dispose();
            };

            tabPage.Controls.Add(urlbox);
            tabPage.Controls.Add(nav);
            tabPage.Controls.Add(newTab);
            tabPage.Controls.Add(closeTab);
            tabPage.Controls.Add(browser);
            tabPage.Controls.Add(scrollDown);
            tabPage.Controls.Add(scrollUp);
        }