How to Create Bookmarklets

Bookmarklets are very usefull and timesaving piece of javascript code and that you can use.

first let's see how a bookmarklets look like.

Create Bookmarklet

Before starting to create bookmarklets few things you should keep mind,

One Liner Bookmarklets

if JavaScript code is simple then you can write that in one line and your custom bookmarklet is ready.


This type of bookmarklet is good if you want to extract some basic information from page where you don't need to keep track of any value.


Bookmarklets that require more than one line

If your code is a bit complex and needs more space then use the wrap your function like following IIF IEF JavaScript immediately invoked function [ref]

/* variation 1 */
/* function logic here */
/* variation 2 */
/* function logic here */
/* variation 3 */
(async ()=>{
/* function logic here */


Now you can easily convert JavaScript code to Bookmarklets,

If you find it little bit difficult to make bookmarklet then you can take help of bookmarklet maker tools.

By doing so not extra script always loads on everypage, script will run only when you run it.