Techincal Dive

Techincal Dive

Techincal Dive

September 4, 2025

Top Chrome APIs Every Developer Should Try

Top Chrome APIs Every Developer Should Try

Top Chrome APIs Every Developer Should Try

Google Chrome powers about 70% of desktop browsing worldwide. And nearly half of those users have at least one browser extension installed. For developers, that's a massive opportunity to shape how people experience the web.

Extensions unlock that power, and the Chrome API makes it possible to build tools that go far beyond simple add-ons. Many extensions function as full-fledged applications embedded in the browser.

The Chrome API is your direct link into the browser’s core, letting you create sophisticated tools that solve meaningful problems.


Benefits of Using Chrome API

Chrome APIs are the backbone for many advanced extensions. They provide low-level building blocks that take care of the heavy lifting in extension development. Here are a few reasons why developers value Chrome APIs:

  1. Faster development – With less boilerplate to write, you don’t need to reinvent tab management, storage, or notifications.

  2. User-first features – APIs like storage.sync help deliver a smoother experience across devices.

  3. Security baked in – Permissions and sandboxing mean you don’t accidentally open up unsafe security holes.

  4. Cross-browser value – Since Chrome API overlaps with the broader browser API standard, your skills can carry over to other browser environments such as Firefox, Edge, and Safari.

Think of them as shortcuts to the browser's inner wiring. Instead of "faking it" with DOM hacks, you get proper hooks into the system.


Top 10 Chrome API Examples Every Developer Should Try

#1 Organize your tabs with chrome.tabs

This is your command center for managing browser tabs. If you’ve ever wanted to create, query, move, or close tabs programmatically, this is your starting point.

// Save current window as "React Project"
async function saveSession() {
  const tabs = await chrome.tabs.query({ currentWindow: true });
  const urls = tabs.map(t => t.url);
  await chrome.storage.local.set({ reactProject: urls });
  console.log("Session saved!");
}

For example, you can create a Session Manager that saves all your currently open tabs into a named group, like "Morning Standup" or "React Project."

Later, you can restore that entire group with a single click.

// Restore "React Project" session
async function restoreSession() {
  const { reactProject = [] } = await chrome.storage.local.get("reactProject");
  for (const url of reactProject) {
    await chrome.tabs.create({ url });
  }
  console.log("Session restored!");
}

Note: when you are using different Chrome API methods (e.g chrome.tabs ) you need to provide the appropriate permissions in your manifest.json.

{
  "manifest_version": 3,
  "name": "Tab Saver",
  "version": "1.0.0",
  "permissions": ["tabs", "storage"],
  "background": { "service_worker": "background.js" },
  "action": {}
}

#2 Store things with chrome.storage

An extension without a memory isn't very useful across time. chrome.storage lets you save user settings and data. The best part? Use storage.sync, and the data will follow your users across any computer they’re logged into Chrome.

// Add and persist a to-do task
function addTask(task) {
  chrome.storage.sync.get({ todos: [] }, (data) => {
   chrome.storage.sync.set({ todos: [...data.todos, task] });
  });
}

For example, you can create a "Minimalist Todo List" where a user can add a task, save the list to chrome.storage.sync. They can add a task to their work desktop and see the todo list instantly on their personal laptop.

#3 Change the page with chrome.scripting

Ever wanted to reach into a webpage and modify its contents? chrome.scripting is how you do it. It lets you safely inject and run your custom JavaScript on nearly any site.

// Auto-fill a job application name field
chrome.scripting.executeScript({
  target: { tabId },
  func: () => document.querySelector("#fullName").value = "Jane Developer"
});

For example, you can build an Automatic Form Filler that goes beyond the browser’s built-in autofill. Create an extension that fills out complex, multi-page forms for things like job applications or bug reports with one click.

#4 Schedule actions with chrome.alarms

If you need a task to run every hour or at 5 PM tomorrow, don’t rely on setTimeout or setInterval JavaScript timers. These can be shut down by Chrome to save memory. The method chrome.alarms is the official and reliable way to schedule future events for Chrome extensions.

// Ping homepage every 15 minutes
chrome.alarms.create("healthCheck", { periodInMinutes: 15 });
chrome.alarms.onAlarm.addListener(() =>
  fetch("https://company.com").then(r => console.log("Status:", r.status))
);

For example, you can build a "Website Health Checker" that sends an alarm that pings your company’s homepage every 15 minutes. If it doesn’t get a 200 OK response, it fires a system notification.

#5 Extend the right-click context menu with chrome.contextMenus

The right-click menu is one of the frequently used menus on a computer. This API allows you to add your own custom options to the right-click context menu that can change based on user interactions, such as clicking on an image, a link, or selecting text.

// Search selected text on Stack Overflow
chrome.contextMenus.create({ id: "soSearch", title: "Search on SO", contexts: ["selection"] });
chrome.contextMenus.onClicked.addListener(info =>
  chrome.tabs.create({ url: "https://stackoverflow.com/search?q=" + info.selectionText })
);

For example, we can create a "Dev Search Tool" where you can select a text, right-click, and choose an option to instantly search for it on GitHub, Stack Overflow, and MDN in new tabs.

#6 Inform your users with chrome.notifications

If you want to send a message to the user without interfering with their browser activities, you can use the chrome.notifications method. This uses a small modal on top of the Chrome UImaking it effective at grabbing attention and clean in design.

// Notify user of new GitHub PR
chrome.notifications.create({
  type: "basic", iconUrl: "icon.png",
  title: "GitHub Update", message: "New PR comment available"
});

For example, we can build a "GitHub Notification Extension" that uses the GitHub API, connected with chrome.alarms to track pull request comments and review requests for updates at scheduled intervals. The notification displays a button through which users can directly access the PR when new updates become available.

#7 Connect the pieces with chrome.runtime

Your extension isn’t just one script; it’s a collection of components like service workers, content scripts, and popups. chrome.runtime is the message bus that lets them all talk to each other. Your extension must process fundamental events, including the onInstalled event after the extension installation.

// Show welcome page on first install
chrome.runtime.onInstalled.addListener(d => {
  if (d.reason === "install") chrome.tabs.create({ url: "welcome.html"          });
});

You can take your user to a "Welcome Page" when they install your extension for the first time by listening to the runtime.onInstalled event. In addition, the following runtime events list gives you more capabilities to handle different use cases.

chrome.runtime.onBrowserUpdateAvailable
chrome.runtime.onConnect
chrome.runtime.onConnectExternal
chrome.runtime.onConnectNative
chrome.runtime.onMessage
chrome.runtime.onMessageExternal
chrome.runtime.onRestartRequired
chrome.runtime.onStartup
chrome.runtime.onSuspend
chrome.runtime.onSuspendCanceled
chrome.runtime.onUpdateAvailable

#8 Block and redirect with chrome.declarativeNetRequest

This is the modern, privacy-focused way of controlling web traffic. Instead of trying to control your browsing manually, you can give the browser a list of rules to follow. It’s incredibly fast and secure.

// Block Reddit during work hours
chrome.declarativeNetRequest.updateDynamicRules({
  addRules: [{ id: 1, priority: 1, action: { type: "block" }, condition: { urlFilter: "reddit.com" } }]
});

For example, you can build a "Distraction Blocker" that lets users enter domains such as x.com or reddit.com. The API generates rules through which all requests to specified sites are blocked during work hours.

#9 Create a companion with chrome.sidePanel

The recently introduced Side Panel API enables developers to create a permanent user interface section adjacent to the current webpage. This feature serves as an ideal solution for essential tools that users need during their browsing activities.

// Open live scratchpad in side panel
chrome.sidePanel.setOptions({ path: "scratchpad.html", enabled: true });
chrome.sidePanel.open({ tabId });

For example, you can build a "Live Code Scratchpad" for developers. When a developer visits a documentation website such as MDN they can launch your side panel to execute code examples directly without navigating away from the page.

#10 Keep track of links with chrome.bookmarks

This gives you full control to create, read, update, and delete bookmarks and folders. You can build powerful tools for people who want to save and search through their favorite web destinations.

// Add a new bookmark
chrome.bookmarks.create({ title: "Check Later", url: "https://example.com"},
  (bm) => console.log("Saved bookmark:", bm));

For example, you can build a "Bookmark Cleaner" that scans all of a user's bookmarks, checks for any that are broken (404s) or redirect, and presents a list that they can clean up in one go.


Conclusion

The Chrome API gives you direct access to the browser's core features. Now it's time to build something that matters to you. Pick one API from this list, start small, and watch your simple extension evolve into something users can't live without.

Get Notifications For Each Fresh Post

Get Notifications For Each Fresh Post

Get Notifications For Each Fresh Post