Source code

Revision control

Copy as Markdown

Other Tools

self.addEventListener('fetch', e => {
if (e.request.url.includes('should-intercept')) {
if (e.request.destination === 'document') {
e.respondWith(fetch('./prerendered-page.html'));
} else {
e.respondWith(new Response('intercepted by service worker'));
}
}
});