Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!
Good Day to All.

I am trying to open google maps using WebBrowser control in VB.Net in Visual Studio 2017.

Here is the simple code.

Private Sub txtSearc_KeyDown(sender As Object, e As KeyEventArgs) Handles txtSearch.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Dim queryaddress As New System.Text.StringBuilder
                queryaddress.Append("https://www.google.com/maps?q=")
                If txtSearch.Text <> "" Then
                    queryaddress.Append(txtSearch.Text + "," & "+")
                End If

                browser_.ScriptErrorsSuppressed = True
                browser_.Navigate(queryaddress.ToString())

            Catch ex As Exception
                Exit Sub
            End Try
        End If
End Sub


But as i load the location, the WebBrowser control shows the page for a couple of seconds then the location disappears the the control shows a error "Update Your Browser to Use Google Maps"

If anyone can help what king of mistake i am doing here, I will be grateful.

Thanks & Regards:
Muhammad Asim Mughal

What I have tried:

Private Sub txtSearc_KeyDown(sender As Object, e As KeyEventArgs) Handles txtSearch.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Dim queryaddress As New System.Text.StringBuilder
                queryaddress.Append("https://www.google.com/maps?q=")
                If txtSearch.Text <> "" Then
                    queryaddress.Append(txtSearch.Text + "," & "+")
                End If

                browser_.ScriptErrorsSuppressed = True
                browser_.Navigate(queryaddress.ToString())

            Catch ex As Exception
                Exit Sub
            End Try
        End If
    End Sub
Posted

1 solution

The WebBrowser control embed an instance of the long-dead Internet Explorer in your application.

Even worse, unless you modify the registry on every machine where your application runs, that instance will be stuck in IE7 rendering mode, meaning almost all modern websites will fail to load.

You need to update your code to use a modern browser control instead - for example, WebView2[^] or CefSharp[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900