One codebase, four browsers, 15+ functional tutorials, 10 Video Tutorials, 3 Templates.
Get instant access to the book, 10 videos, and 3 templates!
Skip the time reading outdated, unsupported documentation from multiple sources and get started with development immediately.
I wrote this book to be the guide I wish I had when we were creating Bugflow's browser extension. Even with 15 years of JavaScript experience, I struggled sifting through the browser extension documentation.
I kept running into questions like:
All these questions will be answered, along with a lot more tutorials about what you can add to your browser extension.
Whether you are just curious on how browser extensions work or have an extension you want to create, we will guide you through the process every step of the way.
I've also created vanilla Javascript, Vue 3, and React based templates to help. Upon purchase of the book, you can immediately pull one or all of these templates from GitHub and get started.
As long as you have a familiarity with JavaScript, the development will be the easy part. The book will guide you through the challenging sections. By the end, you will have an extension works on all four major browsers: Chrome, Firefox, Edge and Safari.
Full-stack Engineer (16+ years)
UX Designer & DevOps Engineer (20+ years)
Since 2011, we've run a successful bootstrapped development consulting agency called 521 Dimensions. Working with a variety of clients and tech stacks, we've gained valuable, real-life experience that we share on our blog, Server Side Up.
We've also created a few products, including Bugflow, a bug tracking tool for developers and wrote another book about developing web and mobile apps from the same codebase. While writing the browser extension for Bugflow, we got inspired to write this book.
Giving back is a huge piece of our beliefs. We are passionate creators of open-source software and have created and contributed to a variety of projects. Check out our GitHub and join our Discord channel to get involved!
Here's a sneak peak of what we will cover in this book.
Content scripts are powerful tools that live on a web page, have access to the DOM, and communicate with your extension.
There are multiple areas in your browser extension to add code. Learn which one is best for what you need.
A popup view is the most familiar way to interact with a browser extension. We will create one using both JS and Vue 3.
Did you know you can have a dedicated page to run your extension? We will make one. You can fit a whole app in this page if you wanted!
Want to allow your user to right click and interact with your extension? We've got you covered.
Authenticating a user with your browser extension is challenging. I'll help you get this enabled.
SSet state, cache data, and interact with your browser's local storage with ease.
Such a simple way to add that extra developer experience when designing and building your browser extension.
Use the latest and greatest Manifest V3 for your extensions. Supported by every browser!
Start immediately with the framework of your choice.
Upon purchase, you can immediately pull down a multi-platform browser extension template and get started. I've made a template for those who prefer Vanilla JS, Vue 3, or React.
Each template is fully functional, documented, and ready to start development. You will get an extension with the following features:
All features come documented and ready to expand upon. Just pull the template and start adding your own code!
Overview of what you will be learning.
Why I Wrote This Book
Other Solutions
What this Book Offers
Browser extensions are niche, but extremely powerful ways to interface with your app.
Request Advanced Browser Permissions
Capture Screenshots
Modify and Process Page Content
Communicate With an API Instantly Without Being on Your Frontend
The best way to ensure efficient development is a clean set up.
Overview
Create your extension directory and initialize
Add src, build, and dist directories
Create manifests for each extension
Adding Action Icons
Adding A Background Script
Install Browser Extension Polyfill
(Optional) Install Vue
(Optional) Install React
(Optional) Install Tailwind
Writing Build Commands
Installing and Debugging your Extension Locally
Conclusion
There's quite a few places to add features in a browser extension. Learn the best practices.
Popups
Extension Pages
Content Scripts
Background Scripts
Other Sources
Set up the most important piece of your browser extension.
Reviewing Where We Are At
Common Background Script Functions
Conclusion
Build a small, interactive window to your extension that's readily accessible
Creating Your Popup View
Adding a Popup in your Manifest Files
Debugging Your Popup
Conclusion
A full tab with a static URL to access parts of your extension.
Adding a pages directory
Adding index.html
Structure your extension pages directory
Adding your CSS
Adding JS
Update your build scripts
Accessing your extension page
Conclusion
Super powerful scripts that are injected into the tab.
Getting Started
Set Up Directories for Building Content Script
Adding a UI to your Content Script
Permissions and Injecting a Content Script
Updating Your Build Script
Conclusion
Learn how to pass messages between all parts of your extension
Routing Messages in Your Browser Extension
Before Getting Started
Types of Message Passing
Structure and Basic Example Using Native Messaging
Structure and Basic Example Using WebExt Bridge
One Time Communication Examples
Long Lived Connections
Wrapping Up
Simple tip to communicate extension state to your user.
Why Would I Change My Icon?
Creating the Icons
Changing the Browser Extension Icon
Allows your users to right-click interact with your extension.
Context Menu Permissions
Registering Your Context Menu
Best Place For This Code
Adding an Action Listener
Deactivating and Hiding the Context Menu
Activating and Showing the Context Menu
References
Enable user interaction with your extension through a keyboard shortcut.
Register your Keyboard Shortcut
Handling Your Command
References
How to link to your extension page.
From a Popup
From the Background Script
Communicate from your first part web page to your extension.
Why Communicate From Your Web Page to Your Extension?
Defining Externally Connectable Web Pages
Using a Content Script to Facilitate Communication
Add to Build Process
Build WebPage Sync Content Script
Build WebPage to Extension Sync Script
Handle WebPage Message In Background Script
Wrapping Up
Resources
Learn how to use your extension on behalf of a user.
Cookie Based Authentication
Token Based Authentication (JWT, oAuth Token, etc.)
Wrapping Up
Extend the power of your browser extension with the help of APIs
Retrieve Data from An API
Append Token for Authenticated Requests
Sending Data to An API
For the little nuances, we set a flag for which browser your extension is installed on
Setting the Config Variable
Using the Config Variable
Determine if your extension is installed live or in development mode
Using the Install Type Response
Resources
Use your browser extension icon as a button without a popup
Removing the Popup
Handle Click Action in Background
Learn how to set up your extension when it's installed.
Add the onInstalled Listener in Service Worker
Modify Event Handler to Perform Action
References
Insert CSS into a tab only when needed.
Ensure You Have Permission
Injecting the Styles
Resources
Set up timed tasks to perform in your browser extension like a cron job.
Update Manifests
Register Alarms
Handling Alarm Events
Resources
Keep track of state and other data efficiently within your extension.
Getting the Right Permissions
Accessing Storage
Setting an Item in Local Storage
Getting a Single Item from Local Storage
Loading Multiple Items From Storage
Removing an Item
Clearing Local Storage
What Can Be Stored in Local Storage
Resources
The easiest way to set up development variables.
Install dotenv-webpack package
Add a .env File in the Root Directory
Add to Build Process
Accessing Your Environment Variables
Conclusion
Keep an eye on when the user needs the power of your extension and when they don't.
Ensure You Have the Right Permissions
Listening to Tab Events Within Your Browser Extension
When to Use onActivated() vs onUpdated()
Resources
When you only need to access the user's active tab.
tab vs activeTab Permission
Getting a Tab by ID
Querying the Active Tab
Using Within onActivated and onUpdated
activeTab Permission
Get started developing immediately with our JavaScript and Vue 3 browser extension templates!
How To Use
Getting Up and Running
Loading Your Extension
Contributing
A little more help on your development journey.
MDN Documentation
Chrome Documentation
Safari Documentation
Our Templates
Other Frameworks & Templates
Packages
Books
Some visual help to see how browser extensions work.
Using our GitHub Templates
Handling Action Button Clicks
Adding a Keyboard Shortcut
Adding a Context Menu
Communication within Your Extension
Working With Local Storage
Changing the Action Icon
Scheduling Background Tasks
Monitoring New Tabs and Updates
Injecting Scripts and CSS into a Tab
Choose the package right for you.
200+ page comprehensive guide (Available in PDF)
Instant access
Lifetime Updates
200+ page comprehensive guide (Available in PDF)
Private GitHub access to extension templates (Vue 3, React, and Vanilla Javascript)
Private GitHub discussion board where you can meet & get help from others
10 In-depth video tutorials
Instant access
Lifetime Updates
How long do I have to wait to get my forum and source code access?
What format is the book in?
Are physical copies available?
Can I get an invoice?
Is the book available in multiple languages?
How can I contact you?