Skip to content

Instantly share code, notes, and snippets.

@unarist
Created February 12, 2020 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unarist/c6fb8145cc03506ba7d269e875c4ca71 to your computer and use it in GitHub Desktop.
Save unarist/c6fb8145cc03506ba7d269e875c4ca71 to your computer and use it in GitHub Desktop.
bookmarklet template
<html>
<body>
<script>
const x =
function() {
// bookmarklet body
};
document.body.innerHTML = '';
document.body.appendChild(document.createTextNode('右のリンクをブックマークバーにドラッグして登録: '));
document.body.appendChild(Object.assign(document.createElement('a'), {href: `javascript:(${encodeURIComponent(x.toString())})()`, textContent: 'example'}));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment