0

I'm creating a custom internet browser in c# using the webbrowser control. And it works i can load sites and browse around and all that. But with some sites (with alot of pictures and such) he wont put everything in the right spot so i will get text blocks inside images and vice versa. How do i solve this ?

My code :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace WindowsFormsApplication13
{
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        WB1.Navigate("http://nos.nl");
    }

    private void GoBtn_Click(object sender, EventArgs e)
    {
        if (AddRsBsr.Text.StartsWith("http://"))
        {
            WB1.Navigate(AddRsBsr.Text);
        }
        else if (AddRsBsr.Text.StartsWith("https://"))
        {
            WB1.Navigate(AddRsBsr.Text);
        }
        else
        {
            WB1.Navigate("http://www.googl.com/search?q=" + AddRsBsr.Text);
        }
    }

   private void AddRsBsr_KeyDown(object sender, KeyEventArgs e)
   {
            if (e.KeyCode == Keys.Return)
            {

            if (AddRsBsr.Text.StartsWith("http://"))
            {
                WB1.Navigate(AddRsBsr.Text);
            }
            else if (AddRsBsr.Text.StartsWith("https://"))
            {
                WB1.Navigate(AddRsBsr.Text);
            }
            else
            {
                WB1.Navigate("http://www.googl.com/search?q=" + AddRsBsr.Text);
            }
        }
    }

   private void BackBtn_Click(object sender, EventArgs e)
   {
       WB1.GoBack();
   }

   private void StopBtn_Click(object sender, EventArgs e)
   {
       WB1.Stop();
   }

   private void HomeBtn_Click(object sender, EventArgs e)
   {
       WB1.Navigate("http://google.nl");
   }
}
}

Now i know my code isn't clean and all but im doing that right now while waiting and hoping for an answer.

Thanks !

Alex K.
  • 171,639
  • 30
  • 264
  • 288

1 Answers1

1

The WebBrowser component defaults to rendering in ... IE7 mode.

To have it behave as IE10/11 you need to make the registry changed described here (FEATURE_BROWSER_EMULATION): http://msdn.microsoft.com/en-us/library/ie/ee330730(v=vs.85).aspx

Alex K.
  • 171,639
  • 30
  • 264
  • 288