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-micro soft-com:v ml">
<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"></s cript>
<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.TERR AIN
}
var map = new google.maps.Map(document.g etElementB yId('map_c anvas'), 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>
<!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-micro
<head>
<meta name="viewport" content="initial-scale=1.0
<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
<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.TERR
}
var map = new google.maps.Map(document.g
var cadLayerOptions = {
preserveViewport: true,
};
var cadLayer = new google.maps.KmlLayer('<url
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
Remove the doctype from the file, the map is rendered both in IE & FF.
Also replace this code with yours (Comma removed)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
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
};
Sample.html
I've requested that this question be deleted for the following reason:
Not enough information to confirm an answer.
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
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.
You don't remove the Doctype.
The error was the comma and the accepted answer just repeats what I said 3 days earlier.