为什么我不能为我的JavaScript应用打开浏览器中的位置?
我已经用javascript创建了一个使用当前位置的应用程序,并在为什么我不能为我的JavaScript应用打开浏览器中的位置?,javascript,google-maps,sharepoint,geolocation,location,Javascript,Google Maps,Sharepoint,Geolocation,Location,我已经用javascript创建了一个使用当前位置的应用程序,并在SharePoint上构建了该应用程序。我正在使用上面的代码。如果我在Sharepoint中运行此应用,我无法使用位置,位置被阻止以保护您的隐私我无法打开位置,因为它是只读的; 我无法使用该位置,即使在我的手机中,我也无法打开该位置。为什么sharepoint网站不能使用位置 请帮帮我 <script type="text/javascript" src="http://maps.googleapis.com/maps/a
SharePoint
上构建了该应用程序。我正在使用上面的代码。如果我在Sharepoint中运行此应用,我无法使用位置,位置被阻止以保护您的隐私
我无法打开位置,因为它是只读的;
我无法使用该位置,即使在我的手机中,我也无法打开该位置。为什么sharepoint网站不能使用位置
请帮帮我
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?
sensor=false"></script>
<script type="text/javascript">
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (p) {
var LatLng = new google.maps.LatLng(p.coords.latitude, p.coords.longitude);
var mapOptions = {
center: LatLng,
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
var marker = new google.maps.Marker({
position: LatLng,
map: map,
title: "<div style = 'height:60px;width:200px'><b>Your location:</b><br />Latitude: " + p.coords.latitude + "<br />Longitude: " + p.coords.longitude
});
google.maps.event.addListener(marker, "click", function (e) {
var infoWindow = new google.maps.InfoWindow();
infoWindow.setContent(marker.title);
infoWindow.open(map, marker);
});
});
} else {
alert('Geo Location feature is not supported in this browser.');
}
</script>
<div id="dvMap" style="width: 500px; height: 500px">
</div>
if(导航器.地理位置){
navigator.geolocation.getCurrentPosition(函数(p){
var LatLng=新的google.maps.LatLng(p.coords.latitude,p.coords.longitude);
变量映射选项={
中心:拉特林,
缩放:13,
mapTypeId:google.maps.mapTypeId.ROADMAP
};
var map=new google.maps.map(document.getElementById(“dvMap”)、mapOptions);
var marker=new google.maps.marker({
位置:LatLng,
地图:地图,
标题:“您的位置:
纬度:“+p.coords.Latitude+”
经度:“+p.coords.Latitude
});
google.maps.event.addListener(标记“单击”,函数(e){
var infoWindow=new google.maps.infoWindow();
infoWindow.setContent(marker.title);
信息窗口。打开(地图、标记);
});
});
}否则{
警报('此浏览器不支持地理位置功能');
}
在现代浏览器上,只允许通过https:
进行地理定位