Last active
November 16, 2016 04:02
-
-
Save luke-denton-aligent/4f2e9caf3ee95b84c692871f070d75df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Offline Web Applications course on Udacity https://classroom.udacity.com/courses/ud899 | |
self.addEventListener('fetch', function(event) { | |
//Tell the browser that we're going to handle this request ourselves | |
//Takes a response object or a Promise, that resolves to a Response | |
event.respondWith( | |
new Response('Hello <strong class="a-winner-is-me">world</strong>', { //String is an example, this isn't the only option here | |
headers: {'Content-Type', 'text-html'} //Need to set the content type to make sure the HTML in the string is parsed | |
}); | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment