Member-only story
Object Oriented Programming in Chrome extension v3 using Modern Vanilla JS
4 min readApr 15, 2023
Here’s a step-by-step tutorial on how to write a Chrome extension v3 using the Object Oriented Programming:
- Open your preferred text editor, and create a new file. Save the file as
manifest.json
in a new folder. This folder will serve as the root directory for your extension. - In
manifest.json
, specify the basic information about your extension. Here's an example:
{
"manifest_version": 3,
"name": "My Awesome Chrome Extension",
"version": "1.0.0",
"description": "This is a description of my awesome extension.",
"homepage_url": "https://my-awesome-chrome-extension.example",
"permissions": [
"activeTab",
"tabs",
"contextMenus",
"idle"
],
"default_locale": "en",
"host_permissions": [
"https://*.google.com/*"
],
"content_scripts": [
{
"matches": [
"https://*.google.com/*"
],
"js": [
"content.js"
],
"run_at": "document_end"
}
],
"web_accessible_resources": [
{
"matches": [
"https://*.google.com/*"
],
"resources": [
"injectablescript.class.js",
"functions.js"
]
}
],
"background": {
"service_worker": "background.js",
"type": "module"
}
}