php - Google map 仅在 Firefox 中显示

标签 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 错误:

[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

最佳答案

根据您提供的错误,我将假设您正在查看的页面是 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。

关于php - Google map 仅在 Firefox 中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17835510/

相关文章:

php - 由于找不到 pdo_mysql 驱动程序导致 Yiic 迁移错误

php - 带有 MySQL 数据库的 PHP Yii 框架上的应用程序是否可以处理 20,000 名员工的 ERP 解决方案?

javascript - Angular2/4 Material 设计,<mat-error> 不工作 - 当没有找到结果时

html - Google map iframe 在 Chrome 中显示速度过快。为什么?

javascript - 谷歌地图没有完全加载

php - while循环多次显示一条记录php和mysql问题

php - 使用 PHP 时区偏移

javascript - 如何在加载时在 chrome android 上保持媒体 session 通知

javascript - 如果包含三个版本的 jquery 并在中间包含一个使用 jquery $ 对象的脚本,会发生什么情况

google-maps - 谷歌地图不显示缩放控件