Browser's geolocation services

提供: fukudat
移動: 案内検索

Modern browsers on mobile PCs and smart phones are equipped with Geolocation Services. This page lists links to documents for configuring your browser to use it.

目次

How to Allow Your Browsers to Use Geolocation Services

Smart Phones (Android/iPhone/iPad)
https://buddypunch.freshdesk.com/support/solutions/articles/4000063036-how-do-i-enable-location-services-on-my-mobile-device-or-browser-
Firefox
https://support.mozilla.org/en-US/questions/988163
Google Chrome
https://yandex.com/support/common/browsers-settings/geo-chrome.html (PC/Mac)
https://support.google.com/chrome/answer/142065?co=GENIE.Platform%3DAndroid&hl=en (Android)
Safari
https://support.apple.com/en-us/HT204690 (Mac)

Google先生に聞く

日本語

英語

How to Get Geolocation Information in a Javascript/Typescript Program

Javascript snippet:

var options = {
  enableHighAccuracy: true,
  timeout: 5000,
  maximumAge: 0
};

function success(pos) {
  var crd = pos.coords;

  console.log('Your current position is:');
  console.log('Latitude : ' + crd.latitude);
  console.log('Longitude: ' + crd.longitude);
  console.log('More or less ' + crd.accuracy + ' meters.');
};

function error(err) {
  console.warn('ERROR(' + err.code + '): ' + err.message);
};

navigator.geolocation.getCurrentPosition(success, error, options);

Typescript snippet:

navigator.geolocation.getCurrentPosition(pos => {
  const lat = pos.coords.latitude.toFixed(6);  // latitude in degree
  const lng = pos.coords.longitude.toFixed(6); // longitude in degree
  ...
}, err => {
  console.warn('ERROR(' + err.code + '): ' + err.message);
}, {
  enableHighAccuracy: true,
  timeout: 5000,
  maximumAge: 0
});
個人用ツール
名前空間

変種
操作
案内
ツールボックス