jackrabbit
Member
- Joined
- Jan 29, 2018
- Messages
- 7
- Programming Experience
- 10+
I have a program that has been running fine for years (VisualStudio 2015, Framework 4.6.1). As part of the program, I have a WebBrowser that can run a PHP page that draws a Google Map at a specific Map type / Longitude / Latitude / Zoom. Unfortunatly, everything when to a halt in February 2022, it just started showing java script errors instead of displaying the map.
For example, to display a map of Central Park, NY, my C# code looks like:
This would call my PHP script with the URL "http://MySite.com/MyMap.php?v=N&x=-73.9665&y=40.7812&z=14". Here is what my PHP page looks like:
Instead of getting my Google map as before, I now only get the popup. No changes were made to my program, so Google must have changed a script within the map:
If I call my PHP script with any browser, it displays my Google Map properly, except for IE 11 where I get a blank screen with the following error on the Console:
I know for a fact that the WebBrowser uses Internet Explorer internally, which support stops in August 2022. Somehow, it looks like Google decided to pull the plug a few months before that deadline.
What will happen with the WebBrowser after that, will it become unusable?
Is there an alternative way to call a PHP script that draws a Google map in a VisualStudio application?
Is there anyone that has a piece of code that still works to display a Google Map?
I know I can still use the following code without a PHP script, but the resulting map if clothered with unwanted popups, and I sill get a warning about Internet Explorer:
For example, to display a map of Central Park, NY, my C# code looks like:
C# program:
string Map = "N";
string Lon = "-73.9665";
string Lat = "40.7812";
string Zoom = "14";
string Url = string.Format("http://MySite.com/MyMap.php?v={0}&x={1}&y={2}&z={3}", Map, Lon, Lat, Zoom);
webBrowser1.Navigate(Url);
This would call my PHP script with the URL "http://MySite.com/MyMap.php?v=N&x=-73.9665&y=40.7812&z=14". Here is what my PHP page looks like:
PHP:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
.infomsg { display:none }
</style>
<script type="text/javascript"
src="https://maps.google.com/maps/api/js?key={GoogleKEY}">
</script>
<script type="text/javascript">
var map;
var mapOptions = { tilt: 0, disableDefaultUI: true };
// Redraw map in a new location
function redraw(newview, newlat, newlon, newzoom) {
if (newview == 'H')
mapOptions.mapTypeId = google.maps.MapTypeId.HYBRID;
else if (newview == 'P')
mapOptions.mapTypeId = google.maps.MapTypeId.TERRAIN;
else
mapOptions.mapTypeId = google.maps.MapTypeId.ROADMAP;
mapOptions.zoom = newzoom;
mapOptions.center = new google.maps.LatLng(newlat, newlon);
if (!map)
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
else
map.setOptions(mapOptions);
}
// Open map with requested URL parameters
function initialize() {
var view = '<?php echo $_GET["v"]; ?>';
var lon = <?php echo $_GET["x"]; ?> + 0;
var lat = <?php echo $_GET["y"]; ?> + 0;
var zoom = <?php echo $_GET["z"]; ?> + 0;
redraw(view, lat, lon, zoom);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
Instead of getting my Google map as before, I now only get the popup. No changes were made to my program, so Google must have changed a script within the map:
If I call my PHP script with any browser, it displays my Google Map properly, except for IE 11 where I get a blank screen with the following error on the Console:
I know for a fact that the WebBrowser uses Internet Explorer internally, which support stops in August 2022. Somehow, it looks like Google decided to pull the plug a few months before that deadline.
What will happen with the WebBrowser after that, will it become unusable?
Is there an alternative way to call a PHP script that draws a Google map in a VisualStudio application?
Is there anyone that has a piece of code that still works to display a Google Map?
I know I can still use the following code without a PHP script, but the resulting map if clothered with unwanted popups, and I sill get a warning about Internet Explorer:
C#:
webBrowser1.Navigate("https://www.google.ca/maps/@40.7812,-73.9665,14z");