title: How to enable geolocation in Chrome
body: <p>I got the HF HTML5 book , and when i reached to the chapter about geolocation and typed the code in , it doesn't work , i tried enabling the geo-location features in preferences but still no change , any suggestions?</p>
  
  <p>The JS:</p>
  
  <pre><code>window.onload = getMyLocation;
      function getMyLocation() {
          if (navigator.geolocation) {
              navigator.geolocation.getCurrentPosition(displayLocation);
          } else {
              alert("Oops, no geolocation support");
      }
  };
  
  function displayLocation(position) {
      var latitude = position.coords.latitude;
      var longitude = position.coords.longitude;
      var div = document.getElementById("location");
      div.innerHTML = "You are at Latitude: " + latitude + ", Longitude: " + longitude;
  };
  </code></pre>
  
  <p>Problem was solved.</p>