title: window.onload work but Chrome console says: Uncaught TypeError: window.onload is not a function
body: <p>I want to run <code>getLocation()</code> method at the page load. I added: <code>window.onload(getLocation());</code> and the function is invoked as I desire but Chrome console says:</p>
  
  <pre><code> Uncaught TypeError: window.onload is not a function(anonymous function) @ (index):116
  </code></pre>
  
  <hr>
  
  <p>The view, the <code>window.onload(getLocation());</code> is at the bottom:</p>
  
  <pre><code>@{
      ViewBag.Title = "Home Page";
  }
  
  
  &lt;div id="demo"&gt;&lt;/div&gt;
  &lt;h2&gt;Gecoding Demo JavaScript: &lt;/h2&gt;
  &lt;div id="map" style="height: 253px ; width: 253px" /&gt;
  
  
  @section Scripts {
      &lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
      &lt;script&gt;
          var x = document.getElementById("demo");
          function getLocation() {
              if (navigator.geolocation) {
                  var position = 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;
              InitializeMap(position)
          }
          var map;
          var geocoder;
          function InitializeMap(position) {
  
              alert(position.coords.latitude+"");
              var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
              var myOptions =
              {
                  zoom: 8,
                  center: latlng,
                  mapTypeId: google.maps.MapTypeId.ROADMAP,
                  disableDefaultUI: true
              };
              map = new google.maps.Map(document.getElementById("map"), myOptions);
          }
  
          window.onload(getLocation());
      &lt;/script&gt;
  }
  </code></pre>