I try to embed a map in my desktop application by using CHtmlView::Navigate2 method to browse local webpage which is a simple google-maps sample html. The html file source as the following.
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?callback=initMap"
async defer></script>
</body>
</html>
The html file with google-maps JavaScript API simple map sample was displayed properly with Internet Explorer but only white color map with vaild zoom control in my CHtmlView window. And I observe that if quickly zoom in/out the map in my test application sometimes the map show up then disappear immediately.
After all-day digging to the issue...
Finally I figure out the root cause might be the IE version applied to the embed MS Web Browser Control. First of all, I have caught related information from Google Map API official community support channel.
Discontinue support of Internet Explorer 8
We would like to inform you that we are planning to discontinue support of Internet Explorer 8 (IE8) for the Google Maps JavaScript API v3 around August 31st 2015.
And then I googled to a related page which mentions how to specify IE version of MS Web Browser Control.(Rick Strahl's Web Blog)
Eventually, I solved my problem by applying Registry Hacks from above link^^
Wish this digging journey is helpful for someone encountered the same problem, Good luck.
As the answer of @Akabrando, adding a registry key of FEATURE_BROWSER_EMULATION can solve the script error of google map. There is another way to solve IE compatible issue, add a meta tag in your webpage: