//Requests and display the requested web page
        private void MakeRequest(String requested, WebBrowser wb, TabPage tab)
        {
            try
            {
                //create new web handler object
                WebHandler web = new WebHandler(requested);

                //set the browser panes to show the result of the web response and web page body
                richTextBox1.Text = web.Response();
                richTextBox2.Text = web.Body();

                //check requests begins with http or https; add http:// if it does not
                if (requested.StartsWith("http://") || requested.StartsWith("https://"))
                {
                    request = requested;
                    wb.Navigate(new Uri(request));
                }
                else
                {
                    request = "http://" + requested;
                    wb.Navigate(new Uri(request));
                }

                //set the tab text to the title of the web page, abbreviate if over 20 characters
                name = web.getName();
                if (name.Length < 20)
                {
                    tab.Text = name;
                }
                else
                {
                    tab.Text = web.getName().Substring(0, 20) + "...";
                }

                //exclude broken links and bad requests from history
                if (web.Response().StartsWith("200") == true)
                {
                    handler.addToHistory(request, name);
                }

                //refresh the url textbox with the requested uri
                textBox1.Text = web.getURI();
            }
            catch (NullReferenceException)
            {
                //If there is a request timeout
                richTextBox1.Text = "An error has occured";
                richTextBox2.Text = "An error has occured";
            }
        }
        //Request and display the homepage
        //We can assume the request is a valid URL for the homepage
        private void MakeInitialRequest(String requested)
        {
            //Make the web request
            WebHandler web = new WebHandler(requested);

            //Display the response and body
            richTextBox1.Text = web.Response();
            richTextBox2.Text = web.Body();

            //add the current web browser to the list of browsers
            webpages.Add(webBrowser1);

            //navigate to the page
            request = requested;
            webBrowser1.Navigate(new Uri(request));

            //set the tab text to the title of the web page, abbreviate if over 20 characters
            name = web.getName();
            if (name.Length < 20)
            {
                tabPage1.Text = name;
            }
            else
            {
                tabPage1.Text = web.getName().Substring(0, 20) + "...";
            }
            current_wb = webBrowser1;
        }