Skip to content

Commit

Permalink
Fix HTTPS warning positioning. Also doesn't matter for localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Apr 7, 2020
1 parent 9f91b55 commit 3b2558d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 2 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,10 @@
</section>-->
</header>

<div class="floating">
<div class="container" style="padding-top:4px">
<p id="requireHTTPS" class="hidden">
<b>STOP!</b> This page <b>must</b> be served over HTTPS.
Please <a>reload this page via HTTPS</a>.
<b>STOP!</b> This page <b>must</b> be served over HTTPS. Please <a>reload this page via HTTPS</a>.
</p>
</div>





<div class="container" style="padding-top:4px">
<p><b>Note:</b> If you have a version of Bangle.js firmware before 2v04, please update to the <a href="https://www.espruino.com/Bangle.js#firmware-updates" target="_blank">latest firmware</a> or
<a href="https://banglejs.com/oldapps/">use the legacy app loader</a>.
</p>
Expand Down
4 changes: 2 additions & 2 deletions js/pwa.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ if ('serviceWorker' in navigator) {
* Installability requires a service worker with a fetch event handler, and
* if the page isn't served over HTTPS, the service worker won't load.
*/
if (window.location.protocol === 'http:') {
if (window.location.protocol === 'http:' && window.location.hostname!="localhost") {
const requireHTTPS = document.getElementById('requireHTTPS');
const link = requireHTTPS.querySelector('a');
link.href = window.location.href.replace('https://', 'https://');
requireHTTPS.classList.remove('hidden');
}
}

0 comments on commit 3b2558d

Please sign in to comment.