c# google maps api - javascript errors on the html part -


i newly want use googlemap api display markers on map in simple c# windows form visual studio.

i use "web browser" component display generated html file basic html code google plus customized coordinate.

        const string htmlpath = "d:/map.html";         streamwriter sw = new streamwriter(htmlpath, false, system.text.encoding.getencoding(437));          string centerlongitude = centerlongitudetextbox.text;         string centerlatitude = centerlatitudetextbox.text;             sw.writeline("<!doctype html>");         sw.writeline("<html>");          sw.writeline("<head>");         sw.writeline("<meta charset=\"utf-8\">");          sw.writeline("<style>");         sw.writeline("html, body, #map{");         sw.writeline("margin :0;");         sw.writeline("padding: 0;");         sw.writeline("height: 100%");         sw.writeline("}");         sw.writeline("</style>");          //sw.writeline("<link rel=\"stylesheet\" href=\"/maps/documentation/javascript/demos/demos.css\">");         sw.writeline("</head>");          sw.writeline("<body>");          sw.writeline("<div id=\"map\"></div>");          sw.writeline("<script>");         sw.writeline("function initmap() {");         sw.writeline("// create map object , specify dom element display.");         sw.writeline("var map = new google.maps.map(document.getelementbyid('map'), {");         sw.writeline("center: { lat: "+ centerlatitude +", lng: "+ centerlongitude +"},");         sw.writeline("scrollwheel: false,");         sw.writeline("zoom: 8");         sw.writeline("});");         sw.writeline("}");         sw.writeline("</script>");          sw.writeline("<script src=\"https://maps.googleapis.com/maps/api/js?key=mykey of course&callback=initmap\"");          sw.writeline("async defer></script>");          sw.writeline("</body>");          sw.writeline("</html>");         sw.close();          webbrowser1.navigate("file:///" + htmlpath); 

this code working good, application text me java script generate errors.

can give me help, don't understand why there error , finding topics or code exemple hard.

thanks reading me.

error

i understand application uses web browser control emulates version of ie.

please note current release version of maps javascript api doesn't support neither old ie versions nor compatibility mode. should use supported browsers mentioned in document:

https://developers.google.com/maps/documentation/javascript/browsersupport

if working webbrowser controls, can default ie 7 rendering mode: https://weblog.west-wind.com/posts/2011/may/21/web-browser-control-specifying-the-ie-version

as can see above article, can write in registry force control newer ie version. recommended specify @ least version 10.

http://www.codeproject.com/articles/793687/configuring-the-emulation-mode-of-an-internet-expl use latest version of internet explorer in webbrowser control

additionally, can add meta tags

<meta http-equiv="x-ua-compatible" content="ie=emulateie10" />

or

<meta http-equiv="x-ua-compatible" content="ie=edge">

in html page header section in order force rendering mode modern version of ie.

as alternative solution can consider different web browser embedded control. example, can @ chromium embedded framework.

https://en.wikipedia.org/wiki/chromium_embedded_framework

there useful discussion in public issue tracker well:

https://code.google.com/p/gmaps-api-issues/issues/detail?id=9004


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -