Google地图仅在Firefox中显示

时间:2013-07-24 13:31:10

标签: php javascript google-maps

我有一个使用Heroku的Facebook应用程序,我使用谷歌地图。谷歌地图仅在Firefox浏览器中显示。 Chrome和IE浏览器无法显示它!

我无法理解为什么,我需要你的帮助!

https://apps.facebook.com/sectorsase/

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script>


<script>
function initialize()
{

var IPos=new google.maps.LatLng(4.256,4.568);
var mapProp = {
  center:new google.maps.LatLng(44.438683,26.027269),
  zoom:13,
  disableDefaultUI:true,
  draggable: false, 
  zoomControl: false, 
  scrollwheel: false, 
  disableDoubleClickZoom: true,
  mapTypeId:google.maps.MapTypeId.ROADMAP
  };
var map=new google.maps.Map(document.getElementById('googleMap'),mapProp);

var marker=new google.maps.Marker({
  position:IPos,
  icon:'icn.png'

  });
 var myCity = new google.maps.Circle({
  center:IPos,
  radius:3,
  strokeColor:'#0000FF',
  strokeOpacity:0.8,
  strokeWeight:2,
  fillColor:'#0000FF',
  fillOpacity:0.4
  });

  myCity.setMap(map); 
  marker.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);
google.maps.event.trigger(map, 'resize');
</script>
</head>

<body>
<center><div id='googleMap' style='width:500px;height:380px;'></div></center>

</body>
</html>

IE错误:

SEC7111: HTTPS security is compromised by http://maps.google.com/maps/api/js?sensor=false 
map.php
SCRIPT1002: Syntax error 
map.php, line 17 character 33

CHROME ERROR:

[blocked] The page at https://quiet-everglades-2697.herokuapp.com/map.php ran insecure content from http://maps.google.com/maps/api/js?sensor=false.  map.php:1 Uncaught ReferenceError: google is not defined map.php:49

1 个答案:

答案 0 :(得分:4)

根据您提供的错误,我将假设您正在查看的网页是HTTPS。您是从非HTTPS来源加载Google Maps API。只需将script代码更改为https://maps.google.com/maps/api/js?sensor=false即可。或者更好//maps.google.com/maps/api/js?sensor=false,它会自动为您填写http或https。