调用Google map API时,JS脚本中出现google未定义的出错信息
这是页面代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=true"></script>
<script type ="text/javascript" src ="Initialize.js"></script>
<link href="Default.css" rel="stylesheet" type="text/css" />
</head>
<body onload ="initialize()">
<noscript><div style="color: red; width: 30%; border: 1px solid red; padding: 4px; font-family: sans-serif;">ERROR: Your web browser must have JavaScript enabled to show this panorama.</div></noscript>
<form id="form1" runat="server">
<div id="Title">
</div>
<div id="Panorama">
</div>
<div id="Maps">
</div>
</form>
</body>
</html>
JS脚本:
function initialize()
{
var latlng = new google.maps.LatLng(39.068092,116.315267);
var myOptions =
{
zoom: 17,
center: latlng,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
var map = new google.maps.Map(document.getElementById("Maps"),myOptions);
}
------解决方案--------------------那是因为。国内的防火墙进行了限制
https://maps.google.com/maps/api/js?sensor=true
这个url目前无法访问导致