๐Ÿš€ Special Notes & Pro Tips

Validate Permissions

  • "activeTab" โ€” when your extension needs to interact with the current tab.
  • "storage" โ€” if you need to save data locally.
  • "clipboardWrite" โ€” if you need to copy text to the clipboard.
  • "tabs" โ€” if you need to access tab info (more advanced).
  • "host_permissions" โ€” to allow your extension to work on specific sites (e.g. https://abc.com/*).

Validate Host Permissions

  • Make sure host_permissions match the actual sites you want:
    • Example: https://abc.com/* or https://*.yourdomain.com/*
  • Use wildcards carefully.
  • Test URLs manually in a browser to ensure scripts are injected where expected.

Validate File Structure

  • Only include necessary files:
    • manifest.json
    • Code files (popup.js, content.js, etc.)
    • UI files (popup.html, options.html, etc.)
    • Icons (icon-16.png, icon-48.png, icon-128.png)
  • Avoid including:
    • .git/, node_modules/, or other development-only files.

Validate Manifest.json

  • Check syntax using a JSON validator (e.g. https://jsonlint.com/).
  • Confirm:
    • manifest_version: 3 (always use the latest spec)
    • All required fields: name, version, description, action, permissions, host_permissions, etc.
    • Icon paths are correct.

Validate Scripts (popup.js || content.js || background.js)

  • You can use console.log() generously to debug.
  • Verify DOM elements exist before accessing them.
  • Handle errors gracefully with try/catch blocks.
  • Avoid accessing URLs or resources not allowed by permissions.

Validate Icons

  • Verify all required icon sizes exist:
    • icon-16.png
    • icon-32.png
    • icon-48.png
    • icon-128.png
  • Make sure icons are referenced correctly in manifest.json.

Validate UI (popup.html, options.html)

  • Test the popup interface directly.
  • Check all buttons, inputs, and interactions work correctly.
  • Ensure popup content fits properly in small popup window sizes.

Test on Multiple Sites

  • Visit allowed sites (host_permissions) to verify content scripts load.
  • Visit non-allowed sites to verify the extension does not run where it shouldnโ€™t.
  • Use Chrome DevTools Console to monitor logs and errors.

Test Update Flow

  • After making changes, use chrome://extensions/ > click Reload.
  • Retest all key functionality after updates.
Discussion
Awesome ๐Ÿ”ฅ

3

Great tutorial, thanks for sharing !

3

Insightful

3

42

4