Skip to content

Instantly share code, notes, and snippets.

@d33tah
Created December 27, 2016 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d33tah/87edc96c7ff0fab8d9e54965e72e6532 to your computer and use it in GitHub Desktop.
Save d33tah/87edc96c7ff0fab8d9e54965e72e6532 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<script>
navigator.serviceWorker.register('/sw.js').catch(e=>console.error('Ups!' + e))
</script>
</head>
<body>
Tutaj nic nie ma.
</body>
</html>
self.addEventListener('fetch', function(ev) {
if (ev.request.url.endsWith('.worker')) {
ev.respondWith(new Response('<strong>Ten URL istnieje!</strong>',
{headers:
{"Content-type":"text/html"}
}));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment