Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This code worked for me -- on the iPhone web browser <strong>Safari</strong> <em>and</em> as an added bonus it even worked with <strong>FireFox 3.5</strong> on my laptop! The Geolocation API Specification is part of the W3 Consortium’s standards <strong>But be warned: it hasn’t been finalized as yet.</strong></p> <p><a href="http://blog.bemoko.com/wp-content/uploads/2009/06/iphone-geo-300-1-150x150.jpg">alt text http://blog.bemoko.com/wp-content/uploads/2009/06/iphone-geo-300-1-150x150.jpg</a> <a href="http://blog.bemoko.com/wp-content/uploads/2009/06/iphone-geo-300-2-150x150.jpg">alt text http://blog.bemoko.com/wp-content/uploads/2009/06/iphone-geo-300-2-150x150.jpg</a></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;Geolocation API Demo&lt;/title&gt; &lt;meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport"/&gt; &lt;script&gt; function successHandler(location) { var message = document.getElementById("message"), html = []; html.push("&lt;img width='256' height='256' src='http://maps.google.com/maps/api/staticmap?center=", location.coords.latitude, ",", location.coords.longitude, "&amp;markers=size:small|color:blue|", location.coords.latitude, ",", location.coords.longitude, "&amp;zoom=14&amp;size=256x256&amp;sensor=false' /&gt;"); html.push("&lt;p&gt;Longitude: ", location.coords.longitude, "&lt;/p&gt;"); html.push("&lt;p&gt;Latitude: ", location.coords.latitude, "&lt;/p&gt;"); html.push("&lt;p&gt;Accuracy: ", location.coords.accuracy, " meters&lt;/p&gt;"); message.innerHTML = html.join(""); } function errorHandler(error) { alert('Attempt to get location failed: ' + error.message); } navigator.geolocation.getCurrentPosition(successHandler, errorHandler); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="message"&gt;Location unknown&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload