문제

I'm using the Javascript below to detect the geolocation service:

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);

Android, Apple prompts for geo location service whereas Nokia Lumia 920 doesn't prompt. Could someone please confirm whether I need to enable anything? Location detector is already enabled.

도움이 되었습니까?

해결책

By default the Nokia Lumia 920 runs an IE10 browser which does support HTML5 geolocation.

You can check this using the link on w3schools.com. Clicking the try it button, it prompted me for my location as you would expect. The site also helpfully provides the code.

The HERE Maps API for JavaScript offers the nokia.maps.positioning.Manager which wraps this nicely and also works in mobile - try the example here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top