Web Browser in C#

Web Browser in C#

Everyone needs a web browser for some work in our day to day life for surfing, social networking, fun or any other stuff. Has anyone ever tried to create their own web browser? How cool it would be, you could provide it your name and provide functionalities depending on you. You can use it in Windows 8, Windows 8 RT or any versions or you can launch it at Windows 8 store for free.

To create a web browser in the .NET framework, there are some fundamental steps shown in this article through which you can easily create your own web browser. You can use Visual Studio as a tool for creating the web browser.
(I personally recommend using Visual Studio 12 for better functioning.)

Web-Browser
For creating web browser

Step 1: Basic Step

In this first step you need to code in a blank C# web form, depending on this code. Apply and make changes in your blank web form. Use the following procedure to create it.

public MainPage()

{

   this.InitializeComponent();

}

/// <summary>

/// Invoked when this page is about to be displayed in a Frame.

/// </summary>

/// <param name="e">

 

Event data that describes how this page was reached. The Parameter:

 

/// property is typically used to configure the page.

</param>

protected override void OnNavigatedTo(NavigationEventArgs e)

{

}

private async void hypertextbutton1_Click(object sender, RoutedEventArgs e)

{

    string name = "http://" + textbox1.Text;

    Uri url = new Uri(name, UriKind.Absolute);

    webview1.Source = url;

}

private void textbox1_Tapped(object sender, TappedRoutedEventArgs e)

{

  this.Frame.GoBack();

}

Step 2: Navigation

For the navigation option in your own web browser you need to use this code in your web browser:

public MainPage()

{

    this.InitializeComponent();

}

/// <summary>

/// Invoked when this page is about to be displayed in a Frame.

/// </summary>

/// <param name="e">

Event data that describes how this page was reached.  The Parameter

/// property is typically used to configure the page.

</param>

protected override void OnNavigatedTo(NavigationEventArgs e)

{

}

private async void hypertextbutton1_Click(object sender, RoutedEventArgs e)

{

  this.Frame.Navigate(typeof(BlankPage1));

}
 

Step 3: Going back

For one of the most common functions of your web browser, the Back button, you need to use the following code. This is the last step of the entire procedure, after this you can launch it and view in the web browser as an initial step or you can use it through the file created in the doc folder.
 

public MainPage()

{

    this.InitializeComponent();

}

/// <summary>

/// Invoked when this page is about to be displayed in a Frame.

/// </summary>

/// <param name="e">

Event data that describes how this page was reached. The Parameter

/// property is typically used to configure the page.

</param>

protected override void OnNavigatedTo(NavigationEventArgs e)

{

}

private async void hypertextbutton1_Click(object sender, RoutedEventArgs e)

{

    this.Frame.GoBack(); //tapped box

    this.Frame.GoBack(); //button of 2nd window

}

Up Next
    Ebook Download
    View all
    Learn
    View all