diff options
Diffstat (limited to 'testing/marionette/harness/marionette_harness/www/html5/geolocation.js')
-rw-r--r-- | testing/marionette/harness/marionette_harness/www/html5/geolocation.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/marionette/harness/marionette_harness/www/html5/geolocation.js b/testing/marionette/harness/marionette_harness/www/html5/geolocation.js new file mode 100644 index 000000000..f07af148e --- /dev/null +++ b/testing/marionette/harness/marionette_harness/www/html5/geolocation.js @@ -0,0 +1,18 @@ +function success(position) { + var message = document.getElementById("status"); + message.innerHTML ="<img src='http://maps.google.com/maps/api/staticmap?center=" + position.coords.latitude + "," + position.coords.longitude + "&size=300x200&maptype=roadmap&zoom=12&&markers=size:mid|color:red|" + position.coords.latitude + "," + position.coords.longitude + "&sensor=false' />"; + message.innerHTML += "<p>Longitude: " + position.coords.longitude + "</p>"; + message.innerHTML += "<p>Latitude: " + position.coords.latitude + "</p>"; + message.innerHTML += "<p>Altitude: " + position.coords.altitude + "</p>"; +} + +function error(msg) { + var message = document.getElementById("status"); + message.innerHTML = "Failed to get geolocation."; +} + +if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(success, error); +} else { + error('Geolocation is not supported.'); +}
\ No newline at end of file |