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
| addEventListener('fetch', event => { | |
| event.respondWith(handleRequest(event.request)) | |
| }) | |
| async function handleRequest(request) { | |
| // Fetch the original HTML response | |
| const response = await fetch(request) | |
| // If the response is a redirect, return it immediately without modification | |
| if (response.redirected || response.status === 301 || response.status === 302) { |