mirror of https://github.com/espruino/BangleApps
Fix HTTPS warning positioning. Also doesn't matter for localhost
parent
9f91b5559b
commit
3b2558ddd8
14
index.html
14
index.html
|
@ -65,18 +65,10 @@
|
|||
</section>-->
|
||||
</header>
|
||||
|
||||
<div class="floating">
|
||||
<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>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<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>.
|
||||
</p>
|
||||
<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>
|
||||
|
|
|
@ -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('http://', 'https://');
|
||||
requireHTTPS.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue