Get your API key

Lesson 3 of 5

Highlight keywords with the fewest permissions

Add a Highlight button with activeTab and scripting, see which warnings Chrome shows for each permission, follow the Manifest V3 rules, and keep API keys out of your extension.

8 min Log in to open
One step at a time, like flipping pages.

By the end of this lesson Job Hunt Helper will mark your keywords on a job page with one click, using only permissions that show users no warning.

You need: Job Hunt Helper 0.1 from lesson 2, loaded in Chrome · Time: 8 minutes

  1. A content script is JavaScript that runs inside a web page. It can read the page text and change it, for example wrap the word "fresher" in a yellow marker. There are two ways to put it on a page:

    1. Automatically, on sites you list in the manifest (for example every page on www.naukri.com). Handy, but the extension asks for access to those sites all the time, and Chrome warns the user at install.
    2. On click, with the activeTab and scripting permissions. Nothing runs until you click a button in the popup, and then only on the tab you are looking at. activeTab gives the extension temporary access to the current tab after you click; scripting lets it put a script on that tab.

    Job Hunt Helper uses way 2. You want highlights only when you ask for them, and it works on any job site without listing each one.

    Why?

    Access that starts with your click is the safest kind: the extension sees nothing while you browse your bank or email. It also means no scary warning and an easier store review.

Log in free to read the rest of this lesson

Every lesson is free. A free account unlocks all of them and saves your progress.

Still to come in this lesson:

  1. What Chrome tells users about each permission
  2. Add the Highlight button
  3. Manifest V3 rules your extension must follow
  4. Never ship an API key inside an extension
  5. Recap