title: get location when pages loads
body: <p>I am Building a website useing HTML, CSS and Java script. I am wanting to get the location of the user when page loads. so they do not need to press a button. I was hoping some one can help. </p>
  
  <pre><code>!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;p id="demo"&gt;Click the button to get your coordinates:&lt;/p&gt;
  &lt;button onclick="getLocation()"&gt;Try It&lt;/button&gt;
  &lt;script&gt;
  var x=document.getElementById("demo");
  function getLocation(){
   if (navigator.geolocation){
     navigator.geolocation.getCurrentPosition(showPosition);
   }
   else{
     x.innerHTML="Geolocation is not supported by this browser.";}
   }
  
  function showPosition(position){
    x.innerHTML="Latitude: " + position.coords.latitude + 
    "&lt;br&gt;Longitude: " + position.coords.longitude;    
   }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>