Link to home
Start Free TrialLog in
Avatar of jmoran18251
jmoran18251

asked on

Page loads in Firefox but not IE

I am using the Google Maps API to generate a map with a single KML file.  It works fine with Firefox, but displays a blank page when viewed in IE.  There are no errors displayed and this is the source that is shown in IE.

<!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>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta charset="utf-8"/>
<title>Cumberland County LiveCAD Map</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
      function initialize() {
        var latlng = new google.maps.LatLng(43.83, -70.42);
        var mapOptions = {
          center: latlng,
          zoom: 10,
          mapTypeId: google.maps.MapTypeId.TERRAIN
        }

        var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
            var cadLayerOptions = {
              preserveViewport: true,
          };
        var cadLayer = new google.maps.KmlLayer('<url>', cadLayerOptions);
        cadLayer.setMap(map);
            }
      </script>
</head>
<body class="background" onload="initialize()">
      <div id="map_canvas" style="width:100%; height:100%; float:left"></div>
</body>
</html>
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Maybe this http://code.google.com/p/html5shiv/ will help. My site (HTML5) doesnt work on IE8 and earlier. But works on FF
I guess there is some issue with the doc type specified.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Open in new window


Remove the doctype from the file, the map is rendered both in IE & FF.

Also replace this code with yours (Comma removed)
 var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
            var cadLayerOptions = {
preserveViewport: true
          };

Open in new window

Sample.html
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
IE7 was the only browser it failed to load in and removing the comma as pointed out here
https://www.experts-exchange.com/questions/27832963/Page-loads-in-Firefox-but-not-IE.html?anchorAnswerId=38305603#a38305603

...fixed that
Uh?
You don't remove the Doctype.
The error was the comma and the accepted answer just repeats what I said 3 days earlier.