<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Shoutbox test</title>
<script>
  if(location.hostname !== 'localhost' && location.protocol === 'http:') {
    location = location.href.replace('http:', 'https:');
  } else if (localStorage.shouldBeLoaded) {
    document.addEventListener('DOMContentLoaded', function () {
      document.getElementById('message')
      .innerHTML = 'Service Worker failed silently. Reload to try again.';
      localStorage.shouldBeLoaded = '';
    });
  } else if(navigator.serviceWorker) {
    navigator.serviceWorker.register('loader.js', {scope:'.'}) // it was / because I copyed code from qgustavor/wshp.tk
    .then(function () {
      document.getElementById('message')
      .innerHTML = 'This page will reload now in other to finish registration';
      localStorage.shouldBeLoaded = true;
      location.href = '';
    }, function(err){
      document.getElementById('message')
      .innerHTML = 'Your browser supports Service Workers, but <strong>registration failed</strong>';
      throw err; /* on Chrome it shows in the console */
    });
  } else {
    document.addEventListener('DOMContentLoaded', function () {
      document.getElementById('message')
      .innerHTML = "If you're seeing this then maybe your<br>browser <strong>don't support Service Workers</strong>.";
    });
  }
</script>
<style>/* based on Google error pages */
  *{margin:0;padding:0}
  html{font:15px/22px sans-serif;background:#03A9F4;color:#222;padding:15px;text-align:center;}
  body{background:#FFF;margin:7% auto 0;max-width:500px;padding:30px;border-radius:3px}
  p{margin:11px 0 22px}
  strong{color:#111}
</style>
<h1>Shoutbox test</h1>
<p id="message">The page is loading, please <noscript>enable JavaScript, reload and </noscript>wait a little.