void WebBrowser_Quit(object sender, EventArgs e)
        {
            // This event is launched when window.close() is called from script
            ExtendedWebBrowser brw = sender as ExtendedWebBrowser;

            if (brw == null)
            {
                return;
            }
            // See which page it was on...
            BrowserControl bc = BrowserControlFromBrowser(brw);

            if (bc == null)
            {
                return;
            }

            TabPageEx page = bc.Tag as TabPageEx;

            if (page == null)
            {
                return;
            }

            // We got a page, remove & dispose it.
            _tabControl.TabPages.Remove(page);
            page.Dispose();

            if (_tabControl.TabPages.Count == 0)
            {
                _tabControl.Visible = false;
            }
        }
        /// <summary>
        /// Closes the active tab
        /// </summary>
        public void Close()
        {
            // Find the active page
            TabPageEx page = (TabPageEx)this._tabControl.SelectedTab;

            // Check wheter there is actually a page selected
            if (page != null)
            {
                // Remove the page
                this._tabControl.TabPages.Remove(page);
                // Dispose the page (controls on the page are also disposed this way)
                page.Dispose();
            }
            if (_tabControl.TabPages.Count == 0)
            {
                _tabControl.Visible = false;
            }
        }