Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to building Chrome Extensions

Introduction to building Chrome Extensions

Arnelle Balane

November 16, 2023
Tweet

More Decks by Arnelle Balane

Other Decks in Programming

Transcript

  1. What are Chrome Extensions? Applications that run inside the Chrome

    browser to provide additional functionality, integrate with third-party services, and customize the user’s browsing experience
  2. Chrome pages overrides Override one of these built-in Chrome pages:

    • New Tab • History • Bookmark Manager
  3. Chrome Extension capabilities and limitations Chrome pages overrides Popups Side

    panels Content scripts DevTools pages Service workers Page DOM Chrome APIs DevTools APIs 🤔 Some ❌ ❌ ❌ ❌ ❌ ✅ ❌ ❌ ✅ ❌ ✅ ❌ Very few Some ✅ ✅
  4. Word Counter Counts the number of words in the current

    page and display the count in a popup Let’s pretend to build a Chrome Extension
  5. What does our Chrome Extension need? Popup UI Counts the

    number of words in the web page and sends them to the popup Content script Displays the number of words when extension icon is clicked
  6. What does our Chrome Extension need? popup.html popup.css popup.js content-script.js

    manifest.json 🤔 Popup UI Counts the number of words in the web page and sends them to the popup Content script Displays the number of words when extension icon is clicked
  7. popup.js content-script.js user opens the extension popup 1 requests number

    of words from the content script 2 counts the number of words in the current page 3 responds to the popup with the number of words 4 displays number of words in the popup 5
  8. popup.js content-script.js user opens the extension popup 1 requests number

    of words from the content script 2 counts the number of words in the current page 3 responds to the popup with the number of words 4 displays number of words in the popup 5 how?
  9. 1 Testing Chrome Extensions in development visit chrome://extensions 2 enable

    developer mode 3 select load unpacked and select the directory code folder for the extension
  10. Publishing your Chrome Extensions Create a Chrome Web Store developer

    account chrome.google.com/webstore/devconsole There is a one-time registration fee for creating a developer account
  11. Publishing your Chrome Extensions In the Chrome Web Store console,

    add a new item, fill out your extension’s details, and submit for review
  12. Random tips on building Chrome Extensions Start with a small

    and simple prototype Make your extensions available to other browsers Do not publish automatically after the extension is approved in the Chrome Web Store (personal preference lol) Provide a seamless user experience