<!DOCTYPE html> <html> <head> <!-- Responsive --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <!-- Title --> <title>PWA Tutorial</title> <!-- Meta Tags required for Progressive Web App --> <meta name="apple-mobile-web-app-status-bar" content="#aa7700"> <meta name="theme-color" content="black"> <!-- Manifest File link --> <link rel="manifest" href="manifest.json"> </head> <body> <h1>Boxes</h1> <div id="app"></div> <footer> <p>Credits:</p> <ul> <li><a href="https://www.flaticon.com/free-icons/open-box" title="open box icons">Open box icons created by yoyonpujiono - Flaticon</a></li> </ul> </footer> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/2.2.11/mithril.min.js" integrity="sha512-2/N5u5OSxz7VyKmGbko8Jwx6o8fudoJ70t/Nvu16UoKCyqeDNfvxkDTmj11ibe4fwXSDdojQAxuV+y1Ut1JSkQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> --> <script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/2.2.11/mithril.js" integrity="sha512-HQxrYG+jkimFdOc2fdtpe7urylm7yRsmYekrLMACDZk8GwF7UBnEfjG/e86r+lPUvfNsifVdQKK5iS6IBe70Og==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <script> var LocationsRoute = { view: function() { return m("p", "TODO: a list of locations"); } } var BoxesRoute = { view: function() { return m("p", "TODO: a list of boxes"); } } var ContentsRoute = { view: function() { return m("p", "TODO: a list of contents"); } } window.addEventListener('load', () => { registerSW(); var root = document.getElementById("app"); m.route(root, "/", { "/": LocationsRoute, "/locations": LocationsRoute, "/Boxes": BoxesRoute, "/Contents": ContentsRoute, } ); }); // Register the Service Worker async function registerSW() { if ('serviceWorker' in navigator) { try { await navigator .serviceWorker .register('serviceworker.js'); } catch (e) { console.log('SW registration failed'); } } console.log('SW registration succeeded'); } </script> </body> </html>