Created
May 19, 2015 20:02
-
-
Save nikhilm/8ed1b5f4cc69a70b73f4 to your computer and use it in GitHub Desktop.
fetch crash
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
// Does not handle fetch event. |
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
<html> | |
<body> | |
Hi there | |
<script language="javascript"> | |
if (navigator.serviceWorker.controller) { | |
var fd = new FormData(); | |
fd.append("username", "foo"); | |
fd.append("endpoint", "http://push-here"); | |
var xhr = new XMLHttpRequest(); | |
xhr.open("POST", "/fakeapp"); | |
xhr.send(fd); | |
} else { | |
navigator.serviceWorker.register("sw.js", {scope:"."}) | |
.then(function(reg) { console.log("Succeeded", reg); }) | |
.catch(function(e) { console.log("Error", e); }); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment