title: How can I load map with my current address by using google map api
body: <p>I have tried to load google map with my current location by using google maps api in JavaScript. I have tried this code by using JavaScript but it does not work. 
  After I tried many ways I come to this code and it works perfect.
  This code will return Philadelphia as my current location but I want it to return my home address as my current location 
      
      
          My Google Map App
          
          </p>
  
  <pre><code>    &lt;script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true&amp;libraries=places&amp;key=YOUR_API"&gt;
      &lt;/script&gt;
  
      &lt;script&gt;
          var x = document.getElementById("map");
          var map;
          function getLocation()
          {
              if (navigator.geolocation) 
              {
                  navigator.geolocation.getCurrentPosition(showPosition);
              } 
              else 
              { 
                  x.innerHTML = "Geolocation is not supported by this browser.";
              }
          }
  
          function showPosition(position) 
          {
              var latitude = position.coords.latitude;
              var longitude = position.coords.longitude;
              var center = new google.maps.LatLng(latitude,longitude);
              var myOptions = {
                  center: center,
                  zoom: 13,
                  mapTypeId: google.maps.MapTypeId.ROADMAP
              };
              map = new google.maps.Map(document.getElementById('map'), myOptions);
  
              // Create a marker and set its position.
              var marker = new google.maps.Marker({
                  map: map,
                  position: center,
                  title: 'You are here'
              }); 
          }
  
          google.maps.event.addDomListener(window, 'load', initialize);
      &lt;/script&gt;
  
      &lt;script type="text/javascript"&gt;
          function comple() 
          {
                  var org = document.getElementById('org');
                  var des = document.getElementById('des');
                  var autocomplete = new google.maps.places.Autocomplete(org);
                  var autocomplete2 = new google.maps.places.Autocomplete(des);
          }
          google.maps.event.addDomListener(window, 'load', comple);
      &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body onload="getLocation()"&gt;
  &lt;p&gt;&lt;h1&gt;Car Direction Finder&lt;/h1&gt;&lt;/p&gt;
  &lt;br&gt;
  &lt;form name="form1" id="form1" action="Direction.php" method="post"&gt;
  &lt;p&gt;
  Source:
  &lt;input type="text" name="org" id="org" placeholder="Enter Original Source" size="50" autocomplete="on"&gt;
  Destination:
  &lt;input type="text" name="des" id="des" placeholder="Enter Destination Source" size="50" autocomplete="on"&gt;
  &lt;label for="des"&gt;&lt;/label&gt;
  &lt;input type="submit" value="GO"/&gt;
  &lt;br&gt;
  &lt;/form&gt;
  &lt;div align="center"&gt;
  &lt;table border="2" width="750" height="550" align="center"&gt;
      &lt;tr&gt;
          &lt;td id="map"&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Can someone help me with that??</p>