-
-
Save tallykatt/cddf0863f87f97db2cc7a4371a383844 to your computer and use it in GitHub Desktop.
Bookmark Builder
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Bookmarklet</title> | |
<script> | |
window.onload = function(e) { | |
var bookmark = document.getElementById("bookmark"); | |
var code = document.getElementById("code"); | |
var script = document.getElementById("script"); | |
bookmark.href = "javascript: "+ encodeURIComponent("(function() { " + script.textContent + "}())"); | |
}; | |
</script> | |
</head> | |
<body> | |
<a id="bookmark" href="">Unregsiter Service Worker</a> | |
<div id="code"></div> | |
</body> | |
<script id="script"> | |
console.log("test"); | |
var sw = navigator.serviceWorker; | |
if (sw.controller) { | |
sw.getRegistration(document.location).then(function(reg) { return reg.unregister(); }).then(function() { console.log("Unregister Successful") }).catch(function(e) { console.log("No Service Worker: " + e)}); | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment