<!DOCTYPE html> | |
<meta charset=utf-8> | |
<script> | |
self.onmessage = e => { | |
fetch(e.data.url) | |
.then(response => response.text()) | |
.then(text => e.ports[0].postMessage('Success: ' + text)) | |
.catch(error => e.ports[0].postMessage('Error: ' + error)); | |
}; | |
</script> |