Adding JavaScript
Now, open the background.js file in your favourite code editor
The first four functions are for creating a UI for our extension. Since we are providing options in the context menu, we will use contextMenus.create() function to create a customised context menu. This function has some key:value parameters such as title and contexts; the most important one is the event – which specifies what must be done when certain browser based events occur, i.e., calling