title: HTML5 Geolocation timeout
body: <p>I have implemented the HTML Geolocation feature on my project, however I have noticed its not always reliable.</p>
  
  <p>How can I add a fallback to timeout after x seconds and display an error?</p>
  
  <p><strong>Here is my code:</strong></p>
  
  <pre><code>function getLocation()
  {
      if (navigator.geolocation)
      {
          navigator.geolocation.getCurrentPosition(showPosition);
      }
      else{x.innerHTML = "Geolocation is not supported by this browser, please manually enter your postcode above";}
  
      );
  }
  
  function showPosition(position)
  {
      x.innerHTML = "Latitude: " + position.coords.latitude + 
      "&lt;br&gt;Longitude: " + position.coords.longitude; 
  }
  </code></pre>