Resource: Implementing bookmarklets in JavaScript
- Implement bookmarklet as an IIFE.
- Test the IIFE in the console for a relevant page.
- Minify the finished bookmarklet, e.g. Minify JS Online
- In the Bookmark Manager (Ctrl+Shift+O) choose “Add New Bookmark” under the “Organise” menu.
- Specify a name.
- In URL specify the
javascript:
scheme and delimeter and paste the minified bookmarklet at the end.
e.g.
javascript:(()=>{const t=document.location.hash;if(t.length<2&&"#"!==t[0])return;const e=document.getElementById(t.slice(1));e&&e.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})})();