title: How can I detect if Chrome thinks the current page is a secure origin?
body: <p>As of Chrome 50, Google have removed the ability for Chrome to do a Geolocation lookup unless the page hosted on a secure origin.</p>
  
  <p>See <a href="https://www.chromium.org/Home/chromium-security/prefer-secure-origins-for-powerful-new-features" rel="nofollow noreferrer">https://www.chromium.org/Home/chromium-security/prefer-secure-origins-for-powerful-new-features</a></p>
  
  <p>I am building a widget that will be embedded on websites that I do not control, and my widget has some geolocation features. I want to hide geolocation-related UI in my widget if the user is using Chrome and the origin is not considered secure.</p>
  
  <p>How can I detect non-secure origins?</p>
  
  <h3>Update</h3>
  
  <p>My initial idea was to do something like this:</p>
  
  <pre><code>const geolocationPermitted = () =&gt; {
    return (!window.chrome) || window.location.protocol == 'https:';
  }
  </code></pre>
  
  <p>But this test fails When developing locally, since I serve the site from localhost over plain <code>http</code>. This is considered secure by Chrome though, and the function above return false.</p>