WebKit Browser Control.
Inheritance: System.Windows.Forms.UserControl, IWebKitBrowserHost, IWebKitBrowser
 public CustomUndoSystem(WebKitBrowser browser)
 {
     Owner = browser;
     Owner.Navigating += new WebKitBrowserNavigatingEventHandler(Owner_Navigating);
     Owner.TextChangeInArea += new TextDidChangeInArea(Owner_TextChangeInArea);
     Owner.TextChangeInField += new TextDidChangeInField(Owner_TextChangeInField);
 }
Beispiel #2
0
 public void setCallback(SensorCallback callback, WebKitBrowser webView)
 {
     this.callback = callback;
     thread = new Thread(new ThreadStart(run));
     thread.SetApartmentState(ApartmentState.STA);
     thread.IsBackground = true;
 }
Beispiel #3
0
 public CustomUndoSystem(WebKitBrowser browser)
 {
     Owner                    = browser;
     Owner.Navigating        += new WebKitBrowserNavigatingEventHandler(Owner_Navigating);
     Owner.TextChangeInArea  += new TextDidChangeInArea(Owner_TextChangeInArea);
     Owner.TextChangeInField += new TextDidChangeInField(Owner_TextChangeInField);
 }
Beispiel #4
0
        /// <summary>
        /// Initializes several code routines after the webkit containing element loads
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void browserContainer_Loaded(object sender, RoutedEventArgs e)
        {
            WindowsFormsHost host = new WindowsFormsHost();

            wkBrowser = new WebKit.WebKitBrowser();
            host.Child = wkBrowser;

            this.browserContainer.Children.Add(host);


            wkBrowser.Navigate(ConfigurationManager.AppSettings["url"]);

            this.ViewModel.PropertyChanged += (o, f) =>
            {
                if (f.PropertyName.Equals("URI"))
                {
                    MakeJSCall(this.ViewModel.URI);
                    playSoundFeedback();
                }
            };

            setupTimer.Start();


        }
 void AddEvents(WebKitBrowser browser)
 {
     browser.Navigating += new WebKitBrowserNavigatingEventHandler(webKitBrowser1_Navigating);
     browser.DocumentCompleted +=new WebBrowserDocumentCompletedEventHandler(webKitBrowser1_DocumentCompleted);
     browser.CanGoBackChanged +=new CanGoBackChanged(webKitBrowser1_CanGoBackChanged);
     browser.GeolocationPositionRequest += new GeolocationRequest(browser_GeolocationPositionRequest);
     browser.CanGoForwardChanged +=new CanGoForwardChanged(webKitBrowser1_CanGoForwardChanged);
     browser.CloseWindowRequest +=new EventHandler(webKitBrowser1_CloseWindowRequest);
     browser.DangerousSiteDetected +=new EventHandler(webKitBrowser1_DangerousSiteDetected);
     browser.DocumentTitleChanged +=new EventHandler(webKitBrowser1_DocumentTitleChanged);
     browser.FaviconAvailable +=new FaviconAvailable(webKitBrowser1_FaviconAvaiable);
     browser.HeadersAvailable += new HeadersAvailableEventHandler(browser_HeadersAvailable);
     browser.FormSubmit +=new WillSubmitForm(webKitBrowser1_FormSubmit);
     browser.NewWindowCreated +=new NewWindowCreatedEventHandler(webKitBrowser1_NewWindowCreated);
     browser.PopupCreated +=new NewWindowCreatedEventHandler(webKitBrowser1_PopupCreated);
     browser.ProgressChanged +=new WebKit.ProgressChangedEventHandler(webKitBrowser1_ProgressChanged);
     browser.ShowJavaScriptAlertPanel +=new ShowJavaScriptAlertPanelEventHandler(webKitBrowser1_ShowJavaScriptAlertPanel);
     browser.ShowJavaScriptConfirmPanel +=new ShowJavaScriptConfirmPanelEventHandler(webKitBrowser1_ShowJavaScriptConfirmPanel);
     browser.ShowJavaScriptPromptBeforeUnload +=new ShowJavaScriptPromptBeforeUnloadEventHandler(webKitBrowser1_ShowJavaScriptPromptBeforeUnload);
     browser.ShowJavaScriptPromptPanel +=new ShowJavaScriptPromptPanelEventHandler(webKitBrowser1_ShowJavaScriptPromptPanel);
     browser.StatusTextChanged +=new StatusTextChanged(webKitBrowser1_StatusTextChanged);
     browser.CustomContextMenuManager.ShowContextMenu += new ShowContextMenu(CustomContextMenuManager_ShowContextMenu);
     browser.ResourceIntercepter.ResourceSizeAvailableEvent += new ResourceSizeAvailable(ResourceIntercepter_ResourceProgressChangedEvent);
     browser.ResourceIntercepter.ResourceFinishedLoadingEvent += new ResourceFinishedLoadingHandler(ResourceIntercepter_ResourceFinishedLoadingEvent);
     browser.ResourceIntercepter.ResourceStartedLoadingEvent += new ResourceStartedLoadingHandler(ResourceIntercepter_ResourceStartedLoadingEvent);
     browser.ResourceIntercepter.ResourcesSendRequest += new ResourceSendRequestEventHandler(ResourceIntercepter_ResourcesSendRequest);
     browser.ResourceIntercepter.ResourceFailedLoading += new ResourceFailedHandler(ResourceIntercepter_ResourceFailedLoading);
 }
Beispiel #6
0
 public PrintManager(PrintDocument Document, WebKitBrowser Owner)
 {
     this._document = Document;
     this._owner = Owner;
     this._webFramePrivate =
         (IWebFramePrivate)((IWebView)_owner.GetWebView()).mainFrame();
 }
Beispiel #7
0
 public PrintManager(PrintDocument Document, WebKitBrowser Owner)
 {
     this._document        = Document;
     this._owner           = Owner;
     this._webFramePrivate =
         (IWebFramePrivate)((IWebView)_owner.GetWebView()).mainFrame();
 }
Beispiel #8
0
 public BrowserHelper(string path, Control browserContainer, object scriptObject,bool isUrl = false)
 {
     Browser = new WebKitBrowser();
     Browser.Dock = DockStyle.Fill;
     browserContainer.Controls.Add(Browser);
     Browser.GetScriptManager.ScriptObject = scriptObject;//必须在Add到父控件后GetScriptManager才不为空
     Browser.Navigate(isUrl ? path : LocalToUrl(AppDomain.CurrentDomain.BaseDirectory + path));
 }
Beispiel #9
0
 public SourceViewForm(string text, WebKitBrowser current)
 {
     InitializeComponent();
     textBox.Text = text;
     textBox.Select(0, 0);                   /* @@ */
     textBox.ScrollBars = ScrollBars.Both;   /* @@ */
     this.current = current;
 }
Beispiel #10
0
        public JSManagement(WebKitBrowser browser)
        {
            _owner = browser;
            IWebFrame fe = (IWebFrame)browser.webView.mainFrame();

            ScriptObject = new JSCore.JSContext(fe);
            browser.uiDelegate.AddMessageToConsole += new AddMessage(uiDelegate_AddMessageToConsole);
        }
 public TextContextMenu(WebKitBrowser br)
 {
     this.owner  = br;
     this.Popup += new EventHandler(TextContextMenu_Popup);
     this.MenuItems.Add(LanguageLoader.SearchWithGoogle).Click += new EventHandler(SearchContextMenu_Click);
     this.MenuItems.Add("-");
     this.MenuItems.Add(LanguageLoader.Copy).Click += new EventHandler(CopyContextMenu_Click);
 }
 public WebPolicyDelegate(bool AllowNavigation, bool AllowDownloads, bool AllowNewWindows, WebKitBrowser owner)
 {
     this.AllowDownloads = AllowDownloads;
     this.AllowNavigation = AllowNavigation;
     this.AllowNewWindows = AllowNewWindows;
     this.Owner = owner;
     AllowInitialNavigation = true;
 }
Beispiel #13
0
 public WebPolicyDelegate(bool AllowNavigation, bool AllowDownloads, bool AllowNewWindows, WebKitBrowser owner)
 {
     this.AllowDownloads    = AllowDownloads;
     this.AllowNavigation   = AllowNavigation;
     this.AllowNewWindows   = AllowNewWindows;
     this.Owner             = owner;
     AllowInitialNavigation = true;
 }
Beispiel #14
0
        public JSManagement(WebKitBrowser browser)
        {
            _owner = browser;
            IWebFrame fe = (IWebFrame)browser.webView.mainFrame();

            ScriptObject = new JSCore.JSContext(fe);
            browser.uiDelegate.AddMessageToConsole += new AddMessage(uiDelegate_AddMessageToConsole);
        }
 public ContextMenuManager(WebKitBrowser browser)
 {
     this.Owner                  = browser;
     this.BodyMenu               = new BodyContextMenu(browser);
     this.SelectedTextMenu       = new TextContextMenu(browser);
     this.LinkContextMenu        = new LinkContextMenu(browser);
     this.LinkOrImageContextMenu = new LinkAndImageContextMenu(browser);
     this.ImageContextMenu       = new ImageContextMenu(browser);
 }
 public ImageContextMenu(WebKitBrowser br)
 {
     owner = br;
     this.MenuItems.Add("Open Image").Click += new EventHandler(ImageContextMenu1);
     this.MenuItems.Add("Open Image in New Window").Click += new EventHandler(ImageContextMenu2);
     this.MenuItems.Add("Download Image").Click           += new EventHandler(ImageContextMenu3);
     this.MenuItems.Add("-");
     this.MenuItems.Add("Inspect").Click += new EventHandler(Inspect);
 }
Beispiel #17
0
 void init()
 {
     this.title = System.Configuration.ConfigurationSettings.AppSettings.Get("title");
     this.url   = System.Configuration.ConfigurationSettings.AppSettings.Get("url");
     this.Text  = title;
     browser    = new WebKitBrowser();
     //browser.Dock = DockStyle.Fill;
     //browser.IsScriptingEnabled = true;
     this.Controls.Add(browser);
 }
 void AddTab(WebKitBrowser browser)
 {
     TabPage tab = new TabPage();
     tab.Controls.Add(browser);
     browser.Name = "WebKitBrowser";
     browser.Dock = DockStyle.Fill;
     tabControl1.Controls.Add(tab);
     tabControl1.SelectedTab = tab;
     AddEvents(browser);
 }
 public LinkContextMenu(WebKitBrowser br)
 {
     this.owner = br;
     this.MenuItems.Add("Open Link").Click += new EventHandler(LinkContextMenu_Click);
     this.MenuItems.Add("Open Link in New Window").Click += new EventHandler(LinkContextMenu2_Click);
     this.MenuItems.Add("Download Linked File").Click    += new EventHandler(LinkContextMenu3_Click);
     this.MenuItems.Add("Copy Link").Click += new EventHandler(CopyContextMenu_Click);
     this.MenuItems.Add("-");
     this.MenuItems.Add("Inspect").Click += new EventHandler(Inspect);
 }
Beispiel #20
0
 public BrowserHelper(BrowserHelperParam p)
 {
     Browser = new WebKitBrowser();
     Browser.Dock = DockStyle.Fill;
     Browser.Load += (o, e) =>
     {
         Browser.GetScriptManager.ScriptObject = p.ScriptObject;//必须在Add到父控件后GetScriptManager才不为空
     };
     p.Container.Controls.Add(Browser);
     Browser.Navigate(p.GetUrl());
 }
 void AddTab(string url)
 {
     WebKitBrowser browser = new WebKitBrowser();
     TabPage tab = new TabPage();
     tab.Controls.Add(browser);
     browser.Name = "WebKitBrowser";
     browser.Dock = DockStyle.Fill;
     tabControl1.Controls.Add(tab);
     tabControl1.SelectedTab = tab;
     AddEvents(browser);
     browser.Navigate(url);
 }
 public BodyContextMenu(WebKitBrowser br)
 {
     this.owner  = br;
     this.Popup += new EventHandler(BodyContextMenu_Popup);
     this.MenuItems.Add(LanguageLoader.NavBack).Click    += new EventHandler(BodyContextMenuBack_Click);
     this.MenuItems.Add(LanguageLoader.NavForward).Click += new EventHandler(BodyContextMenuForward_Click);
     this.MenuItems.Add("-");
     this.MenuItems.Add(LanguageLoader.Reload).Click += new EventHandler(BodyContextMenu_Click);
     this.MenuItems.Add(LanguageLoader.Stop).Click   += new EventHandler(BodyContextMenuStop_Click);
     this.MenuItems.Add("-");
     this.MenuItems.Add(LanguageLoader.ViewSource).Click += new EventHandler(BodyContextMenuStopViewSource_Click);
     this.MenuItems.Add("Inspector").Click += new EventHandler(InspectorContextMenu);
 }
        public WebBrowserTabPage(WebKitBrowser browserControl, bool goHome)
        {
            InitializeComponent();

            statusStrip = new StatusStrip();
            statusStrip.Name = "statusStrip";
            statusStrip.Visible = true;
            statusStrip.SizingGrip = false;

            container = new ToolStripContainer();
            container.Name = "container";
            container.Visible = true;
            container.Dock = DockStyle.Fill;

            statusLabel = new ToolStripLabel();
            statusLabel.Name = "statusLabel";
            statusLabel.Text = "Done";
            statusLabel.Visible = true;

            iconLabel = new ToolStripLabel();
            iconLabel.Name = "iconLabel";
            iconLabel.Text = "No Icon";
            iconLabel.Visible = true;

            statusStrip.Items.Add(statusLabel);
            statusStrip.Items.Add(iconLabel);

            container.BottomToolStripPanel.Controls.Add(statusStrip);

            // create webbrowser control
            browser = browserControl;
            browser.Visible = true;
            browser.Dock = DockStyle.Fill;
            browser.Name = "browser";
            container.ContentPanel.Controls.Add(browser);

            // context menu

            this.Controls.Add(container);
            this.Text = "<New Tab>";

            // events
            browser.DocumentTitleChanged += (s, e) => this.Text = browser.DocumentTitle;
            browser.Navigating += (s, e) => statusLabel.Text = "Loading...";
            browser.Navigated += (s, e) => { statusLabel.Text = "Downloading..."; };
            browser.DocumentCompleted += (s, e) => { statusLabel.Text = "Done"; };
            if (goHome)
                browser.Navigate("http://www.google.com");
            browser.ApplicationName = "WebKit.NET-test";
        }
Beispiel #24
0
        public void AddTab(WebKitBrowser browser)
        {
            var tabInfo = new TabInfo();
            browser.Dock = DockStyle.Fill;
            browser.Load += (o, e) =>
            {

                browser.GetScriptManager.ScriptObject = new RecordAdapter() { ListBrowser = WebKitBrowser };
            };
            RegisterEvent(tabInfo, browser);

            tabInfo.TabPage.Controls.Add(browser);
            ucTabContainer1.AddTab(tabInfo);
        }
Beispiel #25
0
        public static void RunScript(WebKitBrowser browser, String function, params object[] args)
        {
            Element scriptElm = browser.Document.CreateElement("script");
            StringBuilder sb = new StringBuilder();
            sb.Append(function + "(");
            foreach (object o in args)
            {
                sb.Append("'" + o.ToString() + "', ");
            }
            sb.Remove(sb.Length - 2, 2);
            sb.Append(")");
            Console.WriteLine("Writing: {0}", sb.ToString());
            scriptElm.AppendChild(browser.Document.CreateTextNode(sb.ToString()));

            NodeList headElm = browser.Document.GetElementsByTagName("head");
            headElm[0].AppendChild(scriptElm);
        }
Beispiel #26
0
 private static void RegisterEvent(TabInfo tabInfo, WebKitBrowser browser)
 {
     tabInfo.TabButton.OnDragOut += (t) =>
     {
         t.MoveToNewForm(MousePosition);
     };
     browser.DocumentCompleted += (o, e) =>
     {
         tabInfo.TabButton.UCText = browser.DocumentTitle;
         tabInfo.TabButton.Tip = browser.DocumentTitle;
     };
     browser.NewWindowCreated += (o, e) =>
     {
         FmTabBase.Default.AddTab(e.WebKitBrowser);
         if (!FmTabBase.Default.Visible)
             FmTabBase.Default.Show();
     };
 }
        private void uiDelegate_CreateWebViewWithRequest(IWebURLRequest request, out WebView webView)
        {
            // Todo: find out why url seems to always be empty
            string url = (request == null) ? "" : request.url();
            NewWindowRequestEventArgs args = new NewWindowRequestEventArgs(url);

            NewWindowRequest(this, args);

            if (!args.Cancel)
            {
                WebKitBrowser b = new WebKitBrowser();
                webView = (WebView)b.webView;
                NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
            }
            else
            {
                webView = null;
            }
        }
Beispiel #28
0
        private void uiDelegate_CreateWebViewWithRequest(IWebURLRequest request, out WebView webView)
        {
            // TODO: find out why url seems to always be empty:
            // https://bugs.webkit.org/show_bug.cgi?id=41441 explains all
            string url = (request == null) ? "" : request.url();
            NewWindowRequestEventArgs args = new NewWindowRequestEventArgs(url);

            NewWindowRequest(this, args);

            if (!args.Cancel)
            {
                WebKitBrowser b = new WebKitBrowser();
                webView = (WebView)b.webView;
                NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
            }
            else
            {
                webView = null;
            }
        }
Beispiel #29
0
        public WebBrowserPageView(int type, int webBrowserType = 0)
        {
            InitializeComponent();

            if (type == 1)
            {
                serverIndexPage  = CompnayIndexPage;
                lblTitle.Content = "公司介绍";
            }
            else
            {
                serverIndexPage  = SchoolIndexPage;
                lblTitle.Content = "校园介绍";
            }

            //默认WebBrowser
            if (webBrowserType == 0)
            {
                webBrowser = new System.Windows.Forms.WebBrowser();
                webBrowser.ObjectForScripting     = new WebBrowserCallbackClass();
                webBrowser.ScriptErrorsSuppressed = true;
                webBrowser.Navigate(serverIndexPage);

                windowsFormsHost.Child = webBrowser;
                grdBrowserHost.Children.Add(windowsFormsHost);
            }
            else
            {
                kitBrowser = new WebKit.WebKitBrowser();
                kitBrowser.Navigate(serverIndexPage);
                windowsFormsHost.Child = kitBrowser;
                grdBrowserHost.Children.Add(windowsFormsHost);

                kitBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(kitBrowser_DocumentCompleted);
            }

            if (System.Configuration.ConfigurationManager.AppSettings["IsDev"] == "true")
            {
                this.Topmost = false;
            }
        }
Beispiel #30
0
        public MainForm(string url, string tmpname)
        {
            InitializeComponent();

            browser = new WebKitBrowser();
            browser.Visible = true;
            browser.Dock = DockStyle.Fill;
            browser.Name = "browser";
            browser.IsWebBrowserContextMenuEnabled = false;
            browser.IsScriptingEnabled = false;

            Controls.Add(browser);
            RegisterBrowserEvents();

            fsw = new FileSystemWatcher(Path.GetDirectoryName(tmpname));
            fsw.Created += new FileSystemEventHandler(fsw_Created);
            fsw.EnableRaisingEvents = true;
            temp_file_name = tmpname;

            browser.Navigate(url);
            browser.Focus();
        }
 public ResourcesIntercepter(WebKitBrowser browser)
 {
     this.Owner = browser;
     Resources = new List<WebKitResource>();
 }
 public WebResourceLoadDelegate(WebKitBrowser o)
 {
     Owner = o;
 }
        private void uiDelegate_CreateWebViewWithRequest(IWebURLRequest request, out WebView webView)
        {
            // Todo: find out why url seems to always be empty
            string url = (request == null) ? "" : request.url();
            NewWindowRequestEventArgs args = new NewWindowRequestEventArgs(url);
            NewWindowRequest(this, args);

            if (!args.Cancel)
            {
                WebKitBrowser b = new WebKitBrowser();
                webView = (WebView) b.webView;
                NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
            }
            else
            {
                webView = null;
            }
        }
Beispiel #34
0
 public WebFormDelegate(WebKitBrowser owner)
 {
     this._browser = owner;
 }
Beispiel #35
0
        private void uiDelegate_CreateWebViewWithRequest(IWebURLRequest request, out WebView webView)
        {
            // TODO: find out why url seems to always be empty:
            // https://bugs.webkit.org/show_bug.cgi?id=41441 explains all
            string url = (request == null) ? "" : request.url();
            NewWindowRequestEventArgs args = new NewWindowRequestEventArgs(url);
            NewWindowRequest(this, args);

            if (!args.Cancel)
            {
                WebKitBrowser b = new WebKitBrowser();
                webView = (WebView) b.webView;
                NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
            }
            else
            {
                webView = null;
            }
        }
 public GlobalPreferences(WebKitBrowser Browser)
 {
     WebKitBrowser.activationContext.Activate();
     this.browser = Browser;
     WebKitBrowser.activationContext.Deactivate();
 }
Beispiel #37
0
 public WebUIDelegate(WebKitBrowser browser)
 {
     this.owner = browser;
 }
 public WebDownloadDelegate(WebKitBrowser browser)
 {
     this.parent = browser;
 }
Beispiel #39
0
 public WebUIDelegate(WebKitBrowser browser)
 {
     this.owner = browser;
 }
 public WebEditingDelegate(WebKitBrowser browser)
 {
     this.owner = browser;
 }
 public WebResourceLoadDelegate(WebKitBrowser o)
 {
     Owner = o;
 }
 public WebFormDelegate(WebKitBrowser owner)
 {
     this._browser = owner;
 }
 public WebDownloadDelegate(WebKitBrowser browser)
 {
     this.parent = browser;
 }
 /// <summary>
 /// Initializes a new instance of the NewWindowCreatedEventArgs class.
 /// </summary>
 /// <param name="browser">The WebKitBrowser showing the contents of the new window.</param>
 public NewWindowCreatedEventArgs(WebKitBrowser browser)
 {
     WebKitBrowser = browser;
 }
Beispiel #45
0
 public ResourcesIntercepter(WebKitBrowser browser)
 {
     this.Owner = browser;
     Resources  = new List <WebKitResource>();
 }
Beispiel #46
0
 public SourceViewForm(string text, WebKitBrowser current)
 {
     InitializeComponent();
     textBox.Text = text;
     this.current = current;
 }
Beispiel #47
0
 public GlobalPreferences(WebKitBrowser Browser)
 {
     WebKitBrowser.activationContext.Activate();
     this.browser = Browser;
     WebKitBrowser.activationContext.Deactivate();
 }
 /// <summary>
 /// Initializes a new instance of the NewWindowCreatedEventArgs class.
 /// </summary>
 /// <param name="browser">The WebKitBrowser showing the contents of the new window.</param>
 public NewWindowCreatedEventArgs(WebKitBrowser browser)
 {
     WebKitBrowser = browser;
 }
 public WebEditingDelegate(WebKitBrowser browser)
 {
     this.owner = browser;
 }
Beispiel #50
0
 private void uiDelegate_CreateWebViewWithRequest(IWebURLRequest request, out WebView webView, bool popup = false)
 {
     WebKitBrowser b = new WebKitBrowser();
     if (request != null)
     {
         if (!string.IsNullOrEmpty(request.url()))
             b.Navigate(request.url());
     }
     webView = (WebView) b.webView;
     string url = newwindowurl;
     if (string.IsNullOrEmpty(newwindowurl) && request != null)
         url = request.url();
     
     NewWindowRequestEventArgs args = new NewWindowRequestEventArgs(url);
     if (popup == true)
     {
         PopupCreated(this, new NewWindowCreatedEventArgs(b));
     }
     else
     {
         NewWindowRequest(this, args);
         NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
     }
     //if (this.Focused == false || ElementAtPoint(this.PointToClient(Cursor.Current.HotSpot)).Type == ElementType.Body || (GetCurrentElement().Type != ElementType.LinkOrUknown || GetCurrentElement().TagName == "BODY" || GetCurrentElement().TagName == "IFRAME" || GetCurrentElement() == null && GetCurrentElement().TagName != "OBJECT"))
     //    {
     //        PopupCreated(this, new NewWindowCreatedEventArgs(b));
     //    }
     //    else
     //    {
     //        NewWindowRequest(this, args);
     //        NewWindowCreated(this, new NewWindowCreatedEventArgs(b));
     //    }
 }
        public WebBrowserTabPage(WebKitBrowser browserControl, bool goHome)
        {
            InitializeComponent();

            statusStrip = new StatusStrip();
            statusStrip.Name = "statusStrip";
            statusStrip.Visible = true;
            statusStrip.SizingGrip = false;

            container = new ToolStripContainer();
            container.Name = "container";
            container.Visible = true;
            container.Dock = DockStyle.Fill;

            statusLabel = new ToolStripLabel();
            statusLabel.Name = "statusLabel";
            statusLabel.Text = "Done";
            statusLabel.Visible = true;

            iconLabel = new ToolStripLabel();
            iconLabel.Name = "iconLabel";
            iconLabel.Text = "No Icon";
            iconLabel.Visible = true;

            progressBar = new ToolStripProgressBar();
            progressBar.Name = "progressBar";
            progressBar.Visible = true;

            statusStrip.Items.Add(statusLabel);
            statusStrip.Items.Add(iconLabel);
            statusStrip.Items.Add(progressBar);

            container.BottomToolStripPanel.Controls.Add(statusStrip);

            // create webbrowser control
            browser = browserControl;
            browser.Visible = true;
            browser.Dock = DockStyle.Fill;
            browser.Name = "browser";
            //browser.IsWebBrowserContextMenuEnabled = false;
            //browser.IsScriptingEnabled = false;
            container.ContentPanel.Controls.Add(browser);

            browser.ObjectForScripting = new TestScriptObject();

            // context menu

            this.Controls.Add(container);
            this.Text = "<New Tab>";

            // events
            browser.DocumentTitleChanged += (s, e) => this.Text = browser.DocumentTitle;
            browser.Navigating += (s, e) => statusLabel.Text = "Loading...";
            browser.Navigated += (s, e) => { statusLabel.Text = "Downloading..."; };
            browser.DocumentCompleted += (s, e) => { statusLabel.Text = "Done"; };
            browser.ProgressStarted += (s, e) => { progressBar.Visible = true; };
            browser.ProgressChanged += (s, e) => { progressBar.Value = e.ProgressPercentage; };
            browser.ProgressFinished += (s, e) => { progressBar.Visible = false; };
            if (goHome)
                browser.Navigate("http://www.google.com");

            browser.ShowJavaScriptAlertPanel += (s, e) => MessageBox.Show(e.Message, "[JavaScript Alert]");
            browser.ShowJavaScriptConfirmPanel += (s, e) =>
            {
                e.ReturnValue = MessageBox.Show(e.Message, "[JavaScript Confirm]", MessageBoxButtons.YesNo) == DialogResult.Yes;
            };
            browser.ShowJavaScriptPromptPanel += (s, e) =>
            {
                var frm = new JSPromptForm(e.Message, e.DefaultValue);
                if (frm.ShowDialog() == DialogResult.OK)
                    e.ReturnValue = frm.Value;
            };
        }