How to run javascript function in only one country and OS?

I saw similar questions as shown below. But none of them work for me. Please help. Find a three letter country code using HTML and Javascript

How to find operating system version using JavaScript

+6
source share
2 answers

Some security features were discovered in the browser to stop the use of JavaScript in the user's location without their consent. Now you can use the following code to get the user's location. It will open a tooltip window allowing the user to get his / her location.

var recieveLocation = function(pos) {
    console.log(pos); // Latitude and Longitude Info 
}

navigator.geolocation.getCurrentPosition(recieveLocation);

. , , .

API Google Map:
https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple

. - HTTPS . . Mozilla Firefox :

[] getCurrentPosition() watchPosition() . , , HTTPS.

SSL- , -, .

+7

navigator.language " ".

navigator.platform .

.

html form, , .

0

Source: https://habr.com/ru/post/1016870/


All Articles