Click here to Skip to main content
14,666,379 members
Rate this:
Please Sign up or sign in to vote.
See more:
hello guys
well i tried to display google maps in my application using c#
well it works at the first sight but than it shows me errors
"an error displayed in the script of this page" and it asked me if i want to continue or not even when i click on yes it shows again . so what should i do ?
thanks guys

What I have tried:

string corx = textBox1.Text;
            string cory = textBox2.Text;
            try
            {
                StringBuilder str = new StringBuilder();
                str.Append("https://www.google.com/maps/@");

                if(corx != string.Empty)
                {
                    str.Append(corx + "," + "+");
                }
                if (cory != string.Empty)
                {
                    str.Append(cory + "," + "+");
                }
                webBrowser1.Navigate(str.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Error !");
            }
Posted
Updated 18-May-20 4:25am
Comments
Richard MacCutchan 16-May-20 12:03pm
   
You will need to look at the script that gives the error to find out what is happening.

Rate this:
Please Sign up or sign in to vote.

Solution 2

The WebBrowser control is stuck in IE7 mode by default, unless you change the registry on every computer which runs your application:
Web Browser Control & Specifying the IE Version - Rick Strahl's Web Log[^]

Google Maps will not work in any version of Internet Explorer prior to IE10. And even then, support for IE10 will be dropped very soon - the plan was originally to drop it by the end of this month, although that may have changed.

If you want to embed a web browser which supports modern sites, you'll need to use something else. For example, CefSharp[^] or WebView[^].
   
Rate this:
Please Sign up or sign in to vote.

Solution 1

That's a text box. you need a web browser control
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100