title: test google maps V3 geolocation locally ?
body: <p>I'm trying to test some geolocation codes on my computer, but I'm not even able to run the examples.
     Although they run perfectly from documentation website when I try to open the html file from my computer I get a blank page, all I do is trying to detect my position...</p>
  
  <p>Here is the code:</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no"&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;link href="/apis/maps/documentation/javascript/examples/default.css"
        rel="stylesheet" type="text/css"&gt;
      &lt;!--
      Include the maps javascript with sensor=true because this code is using a
      sensor (a GPS locator) to determine the user's location.
      See: http://code.google.com/apis/maps/documentation/javascript/basics.html#SpecifyingSensor
      --&gt;
      &lt;script type="text/javascript"
          src="http://maps.googleapis.com/maps/api/js?sensor=true"&gt;&lt;/script&gt;
  
      &lt;script type="text/javascript"&gt;
        var map;
  
        function initialize() {
          var myOptions = {
            zoom: 6,
            mapTypeId: google.maps.MapTypeId.ROADMAP
          };
          map = new google.maps.Map(document.getElementById('map_canvas'),
              myOptions);
  
          // Try HTML5 geolocation
          if(navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position) {
              var pos = new google.maps.LatLng(position.coords.latitude,
                                               position.coords.longitude);
  
              var infowindow = new google.maps.InfoWindow({
                map: map,
                position: pos,
                content: 'Location found using HTML5.'
              });
  
              map.setCenter(pos);
            }, function() {
              handleNoGeolocation(true);
            });
          } else {
            // Browser doesn't support Geolocation
            handleNoGeolocation(false);
          }
        }
  
        function handleNoGeolocation(errorFlag) {
          if (errorFlag) {
            var content = 'Error: The Geolocation service failed.';
          } else {
            var content = 'Error: Your browser doesn\'t support geolocation.';
          }
  
          var options = {
            map: map,
            position: new google.maps.LatLng(60, 105),
            content: content
          };
  
          var infowindow = new google.maps.InfoWindow(options);
          map.setCenter(options.position);
        }
  
        google.maps.event.addDomListener(window, 'load', initialize);
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id="map_canvas"&gt;&lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Please help, can you find out what am I doing wrong?</p>