Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I have a web page contains this code:

JavaScript
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<script type="text/javascript"
      src="http://maps.google.com/maps/api/js?key=AIzaSyDAtuVJT2weVT8ilkKfDcMwmPXe7B1HMj0"></script>

<script type="text/javascript">
    var map;


    function load() {

        var mapOptions = { center: { lat: 31.293514, lng: 36.191711 }, zoom: 7, mapTypeId: google.maps.MapTypeId.HYBRID };
        map = new google.maps.Map(document.getElementById('map'), mapOptions);
        geocoder = new google.maps.Geocoder();
    }

    function showAddress() {
        var address = document.getElementById("addressTEXT").value;
        geocoder.geocode({ 'address': address }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); map.setZoom(14); } else { alert("Geocode was not successful for the following reason: " + status); } });
    }
</script>
<link rel="stylesheet" type="text/css" href="http://code.google.com/css/dev_docs.css"/>
</head>
<body >
                   

      <input type="text" size="60" id="addressTEXT" value="31.293514, 36.191711" />
  <input type="button" value="Set Address" />
  <div id="map" style="width: 600px; margin-removed 20px; height: 600px"></div>

</body>
</html>


its work fine on web browser, but on form web browser i get an error message "see it in the link"
https://www.dropbox.com/s/hy17td9ebsavuiz/script%20error.png?dl=0

here is the web page file
https://www.dropbox.com/s/t1itemwcx7p4720/GetMap.html?dl=0[^]


how to solve this problem?
Posted
Updated 22-Feb-15 21:08pm
v3
Comments
John C Rayan 22-Feb-15 9:52am    
You mean on web browser control you get this error?
M. Daban 22-Feb-15 11:38am    
Yes
John C Rayan 22-Feb-15 12:09pm    
Make sure that you set document mode to the one IE7 or whatever you think will work.
<meta http-equiv="X-UA-Compatible" content="IE=7" >. By default it might be quirks mode
M. Daban 23-Feb-15 3:15am    
that's work for me, but i don't think its a good way to solve the problem according to the IE version on the client computer
John C Rayan 23-Feb-15 4:30am    
It is one of the most commonly used techniques among developers to address IE compatibility issue. Google Map API wont work correctly in quirks mode which is the default behaviour for browser control. So I am not quite sure what other options you have.

1 solution

reference to google maps script file is missing. Please add the script source path.
 
Share this answer
 
Comments
M. Daban 23-Feb-15 3:17am    
oh sorry for that, i put a link in the question contains the web page file
SaranshSrivastava 24-Feb-15 0:54am    
I just tried your code after adding reference of google scripts and it worked fine for me. Can you put a breakpoint/debugger in your code where actually the issue is. It might be some settings.

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