title: Google Maps API: Marker link doesn't work
body: <p>I have been playing around with the Google Maps API and managed to do what I wanted. Basically I'm creating a custom map using some specific parameters from the HTML. The map works well and the marker pops at the correct location, however I have two small issues which I am not able to fix:</p>
  
  <ol>
  <li><p>The marker's link doesn't work - I get the following error message in my log: Uncaught TypeError: Cannot read property '_<em>e3</em>' of undefined</p></li>
  <li><p>When the page loads the map is set on the default location first, then it updates with the specific location when the function is run. Is there anyway I can make it load with the correct location at once?</p></li>
  </ol>
  
  <p>Here is the HTML code with the specific parameters:</p>
  
  <pre><code>&lt;div id="map" data-map-address="120-124 Curtain Road, London, EC2A 3SQ" data-map-link="http://my-destination-link.com"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And here is the JavaScript I use to generate the map:</p>
  
  <pre><code>var map,
      geocoder,
      mapElem = document.getElementById('map'),
      mapHolder = $('#map'),
      mapAddress = mapHolder.attr("data-map-address"),
      mapUrl = mapHolder.attr("data-map-link"),
      image = new google.maps.MarkerImage('http://my-marker-link.com/marker.png',
          new google.maps.Size(123, 123),
          new google.maps.Point(0,0),
          new google.maps.Point(11, 96));
  
  function initialize() {
      geocoder = new google.maps.Geocoder();
      var latlng = new google.maps.LatLng(51.51121, -0.11982),
          mapOptions = {
          zoom: 16,
          disableDefaultUI: true,
          center: latlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP
      }
      map = new google.maps.Map(mapElem, mapOptions);
  }
  
  function codeAddress() {
      geocoder.geocode( { 'address': mapAddress}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
              map.setCenter(results[0].geometry.location);
              var marker = new google.maps.Marker({
                  map: map,
                  position: results[0].geometry.location,
                  url: mapUrl,
                  title: 'Click here to emlarge the map',
                  icon: image
              });
          } else {
              alert('Geocode was not successful for the following reason: ' + status);
          }
      });
  }
  
  google.maps.event.addDomListener(window, 'load', initialize);
  google.maps.event.addDomListener(window, 'load', codeAddress);
  google.maps.event.addListener(marker, 'click', function() {
      window.location.href = marker.url;
  });
  </code></pre>
  
  <p>I would really appreciate if someone could help me to solve these two issues. I looked online and tried the workarounds I found, but I couldn't get it to work properly.</p>
  
  <p>Thanks!</p>