Request header field. Cache-Control is not allowed in Safari.

The following code looks at the user's city from their IP address.

  jQuery(document).ready(function($) {

      var message = '';

      $.ajax({
        url: 'https://freegeoip.net/json',
        type: "GET",
        success: function(result) {
          message = result.city + ' - ';
        }
      })
      .always(function(){
        $('.location span').html(message);
      });

    });

      

It works except in Safari where it gives an error ...

Refused to set unsafe header "Access-Control-Request-Headers" Failed to load resource: Request header field. Cache-Control is not allowed Access-Control-Allow-Headers.

How can I fix this?

+3


source to share





All Articles