Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when a user reject the geolocation service, do i get the reject event?

Tags:

geolocation

I mean, if i have a button on the web page, when a user click the button,

then can get the user's geolocation information.

but before, the browser will ask the user whether accept to use the geolocation service.

if the user reject the geolocation service, can i get the reject event?

like image 378
Troy Avatar asked Apr 01 '11 11:04

Troy


People also ask

What does Navigator Geolocation return?

The Navigator. geolocation read-only property returns a Geolocation object that gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location.

How do you get Geolocation without permission?

You can go for an external service like https://www.geolocation-db.com. They provide a geolocation service based on IP addresses where you don't need user permission.

Which function is used to get the correct position using geolocation API?

The Geolocation. getCurrentPosition() method is used to get the current position of the device.

Which of the following method retrieves the current geographic location of the user?

The HTML Geolocation API is used to get the geographical position of a user.


1 Answers

Yes.

Example:

navigator.geolocation.getCurrentPosition(successCallback, errorCallback);

function successCallback(){
    alert('Thanks for allowing geolocation!');
}

function errorCallback(){
    alert('You denied us access to geolocation...');
}

Check Geolocation API Specification for further reference.

like image 133
Andre Backlund Avatar answered Sep 24 '22 17:09

Andre Backlund