Definition

This test is designed to demonstrate the acquisition of Global Positioning System (GPS) coordinates through a browser.

  • To acquire the current GPS coordinates the navigator.geolocation.getCurrentPosition() function provided by most modern browsers is used.
    *Note: Geolocation is much more accurate for devices with GPS, like a modern smartphone.
    Known Browser Support
    • Chrome 5.0 or >
    • Internet Explorer 9.0 or >
    • Firefox 3.5 or >
    • Safari 5.0 or >
    • Opera16.0 or >
  • Javascript:
    if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
    }

    function showPosition(position) {
    currentLong = position.coords.longitude;
    currentLat = position.coords.latitude;
    }

Steps

  1. Check for browser support of navigator.geolocation
    if (navigator.geolocation) {...}
  2. Read Longitude
    position.coords.longitude
  3. Read Latitude
    position.coords.latitude

Execution

Pending Test Execution...