title: Safari asks permission multiple times with geolocation
body: <p>I've been working on this: <a href="http://davidcool.com/feeds" rel="nofollow">http://davidcool.com/feeds</a></p>
  
  <p>Its works fine in all browsers except for Safari. Sometimes Safari will ask for geolocation permission in an endless loop, sometimes it will ask just once like it's supposed to, most of the time it asks 3 times... All other browsers ask once as planned.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>    function success(position) {
      //output lat+long data
      //console.log(position);
      //var s = document.querySelector('#status');
      //s.innerHTML = "Latitude: " + position.coords.latitude + "&lt;br /&gt;Longitude: " + position.coords.longitude + "&lt;br /&gt;";
      var s = document.querySelector('#status');
      if (s.className == 'success') {
          // not sure why we're hitting this twice in FF, I think it's to do with a cached result coming back    
          return;
      }
      s.innerHTML = "success";
      s.className = 'success';
  
      //get timezone info
      $.ajax({
            url:'https://maps.googleapis.com/maps/api/timezone/json?location=' + position.coords.latitude + ',' + position.coords.longitude + '&amp;timestamp=' + Math.floor(position.timestamp/1000) + '&amp;language=en&amp;key=????',
            dataType: "json",
            async:false,
            cache:false,
            error:
              function(res){
                console.log(res);
                },
            success:
                function(res){
                  //console.log(res);
                  time_zone_id = res.timeZoneId;
                  time_zone_name = res.timeZoneName;
                  //var t = document.querySelector('#status1');
                  //t.innerHTML = "Time Zone ID: " + res.timeZoneId + "&lt;br /&gt;Time Zone Name: " + res.timeZoneName + "&lt;br /&gt;" ;
                }
          });
      //get address info
      $.ajax({
            url:'https://maps.googleapis.com/maps/api/geocode/json?latlng=' + position.coords.latitude + ',' + position.coords.longitude + '&amp;language=en&amp;key=????',
            dataType: "json",
            async:false,
            cache:false,
            error:
              function(res){
                console.log(res);
                },
            success:
                function(res){
                  //console.log(res);
                  city = res.results[2].address_components[1].long_name;
                  address = res.results[2].formatted_address;
                  //var t = document.querySelector('#status2');
                  //t.innerHTML = "Address: " + res.results[0].formatted_address ;
                }
          });
  
      //get weather info
      $('#weather').load("weather.php", {'latitude':position.coords.latitude, 'longitude':position.coords.longitude, 'local_time_zone_id':time_zone_id, 'local_time_zone_name':time_zone_name, 'city':city, 'address':address});
  };
  
  function error(msg) {
    var s = document.querySelector('#weather');
    //s.innerHTML = typeof msg == 'string' ? msg : "Failed to get location. Try refreshing.";
    s.innerHTML = typeof msg == 'string' ? msg : "Failed to get location. Try refreshing.";
    s.className = 'fail';
  };
  
  //get lat+long info
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(success, error);
    //setTimeout(navigator.geolocation.getCurrentPosition(success, error), 500);
  } else {
    error('not supported');
  };
  </code></pre>
  
  <p>I've looked at other people having the same issue but haven't been able to find a clear answer as to why this is happening. Any ideas?</p>
  
  <p>What's interesting is that on my dev Mac it only asks once all the time, on another dev Mac it asks multiple times!!! Same OS and same version of Safari 8.0.6.</p>