リクエストされるたびに Firefox がユーザーに位置情報を共有するように要求しないようにするにはどうすればよいですか?
Google マップ API を使用しています。以下は、場所を共有するための私のコードです。Firefox では、常に下のポップアップで場所を共有するよう求められます。これは、 ShareをクリックしてもNot Nowをクリックしても、毎回発生します。
以下は私のコードです
<% if (!Page.IsPostBack)
{ %>
// opened the share location
if (navigator.geolocation)
{
try
{
navigator.geolocation.getCurrentPosition(onPositionUpdate);
}
catch (err)
{
alert(err);
}
}
else
{
alert("You location is not available. Please enter your location to continue!");
}
<%}%>
function onPositionUpdate(position)
{
var lat = position.coords.latitude;
var lng = position.coords.longitude;
try
{
var latLng = new google.maps.LatLng(lat, lng);
if (marker == null)
{
alert("Sorry we are not able to update your location.");
}
else
{
setTimeout(function ()
{
marker.setPosition(latLng);
map.setCenter(latLng);
document.getElementById('ctl00_ContentPlaceHolderBody_latSel').value = lat;
document.getElementById('ctl00_ContentPlaceHolderBody_lngSel').value = lng;
geocodePosition(latLng);
}, 100);
}
}
catch (err)
{
alert(err);
}
}