Js geolocation, but without a clue - maybe?

Is it possible to get the user's geolocation without a browser prompt?

Here is a sample code from W3

<script> var x = document.getElementById("demo") function getLocation(){ if(navigator.geolocation){ navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML="Geolocation is not supported by this browser.";} } function showPosition(position){ x.innerHTML="Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude; } </script> 

Is there any preventPrompt() -like function?

+2
source share
2 answers

No, you cannot prevent an invitation; its security feature does not allow each user to share their location.

From the W3C Docs :

An appropriate implementation of this specification should provide a mechanism that protects user privacy, and this mechanism should ensure that no location information is available through this API without user permission.

But you can try using the geoip function in the callback.

+3
source

No, It is Immpossible.

A prompt appears so that the user can choose whether you know the location or not.

+1
source

All Articles