title: When I redirect to a page, depending on the country it does not work in https
body: <p>I have the following code, where according to the country I will redirect to a certain page.
  This code works correctly for me in <code>http</code> but if I load the html page using<code>https</code> it does not do anything.</p>
  
  <pre><code>&lt;html&gt;
   &lt;head&gt;
          &lt;script src="//code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"&gt;&lt;/script&gt;
          &lt;script&gt;
                jQuery.ajax( {
                url: '//api.ipstack.com/181.64.157.39?access_key=xxxx',
                type: 'POST',
                dataType: 'jsonp',
                success: function(location) {
                  // If the visitor is browsing from Canada.
                  if (location.country_code === 'CA') {
                    // Redirect him to the Canadian store.
                    //window.top.location.href = 'http://google.com.pe';
                    document.location.href = 'http://google.ca';
                  }
                }
              } );
          &lt;/script&gt;
  
   &lt;/head&gt;
   &lt;body&gt;
  &lt;h2&gt;Hello&lt;/h2&gt;
  
  
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Why does this happen, how do I make it work in both?</p>