空白的空间在地理编码样本应用程序
Blank space in Geocoding sample app
为什么如果我从https://developers.google.com/maps/documentation/javascript/examples/map-geolocation复制代码,当我启动应用程序时,我看到所有空白?我使用模拟器Nexus9.
代码:<!DOCTYPE html>
<html>
<head>
<title>Geolocation</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<script>
// Note: This example requires that you consent to location sharing when
// prompted by your browser. If you see a blank space instead of the map, this
// is probably because you have denied permission for location sharing.
var map;
function initialize() {
var mapOptions = {
zoom: 6
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
// Try HTML5 geolocation
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var pos = new google.maps.LatLng(position.coords.latitude,
position.coords.longitude);
var infowindow = new google.maps.InfoWindow({
map: map,
position: pos,
content: 'Location found using HTML5.'
});
map.setCenter(pos);
}, function() {
handleNoGeolocation(true);
});
} else {
// Browser doesn't support Geolocation
handleNoGeolocation(false);
}
}
function handleNoGeolocation(errorFlag) {
if (errorFlag) {
var content = 'Error: The Geolocation service failed.';
} else {
var content = 'Error: Your browser doesn''t support geolocation.';
}
var options = {
map: map,
position: new google.maps.LatLng(60, 105),
content: content
};
var infowindow = new google.maps.InfoWindow(options);
map.setCenter(options.position);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
尝试修改:
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=set_to_true_or_false"></script>
相关文章:
- 将地理编码结果转换为php变量以发布到mysql数据库
- Json在完整日历中对数据进行了编码
- 在jquery中需要cloudinary图像和视频样本代码
- 如何对每个用户每天只允许单击一次的按钮进行编码
- Javascript字符集编码
- 如何在javascript转换编码中将一个动态值从一个表单添加到另一个页面
- base64编码的图像比intranet中的常规图像好吗
- 我不知道我的编码有什么问题.(JavaScript)
- 为什么字符编码对URL很重要
- 如何在做PHP时在base64中动态编码;preg_ replace”;
- 如何将JSON编码的PHP数组发送到同一页面上的数据表
- 如何使Jquery编码的动态下拉菜单与PHP GET变量协调工作
- JavaScript代码,用于在浏览器中显示字节数组中的PDF文件(非base64编码)
- 以HTML文件中的编码形式脱机存储图像
- 从Base64 Ionic编码和解码图像
- 错误编码的Adsense广告正在扼杀我的网站's的性能
- 如何在JS中编码URL并在PHP中解码
- 使用php在html中搜索硬编码的JavaScript变量
- 如何在JavaScript/Node中计算SHA256哈希和Base64字符串编码
- 空白的空间在地理编码样本应用程序