Last active
May 8, 2018 00:15
-
-
Save futurist/697b9d7153042dba4e53e9404509cf38 to your computer and use it in GitHub Desktop.
Iframe With Service Worker
This file contains 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
<script> | |
onload=e=>{ | |
document.open() | |
document.write(`<script src=b.js><\/script>`) | |
document.close() | |
} | |
</script> |
This file contains 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
<iframe id=abc></iframe> | |
<script> | |
const {serviceWorker} = navigator | |
serviceWorker.register('service-worker.js') | |
.then(serviceWorker.ready) | |
.then(reg=>{ | |
document.getElementById('abc').src='b.html' | |
}) | |
</script> | |
This file contains 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
onfetch=e=>console.log(e.request.url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment