So far, 2023 has been a busy year in the world of Chrome extensions. Your valuable feedback has allowed us to improve the extension platform and our documentation. We also continue collaborating with other browser vendors in the WebExtensions Community Group so that extension APIs work more consistently across browsers.
In this post, we’ll share with you a few changes that the Chrome extension team has worked on during the first half of this year and what upcoming features will be released later this quarter. Let's get started!
New extension APIs and features
In this section, I want to highlight some significant API launches, briefly review other API improvements, and share upcoming API releases.
Highlights
Offscreen documents
The Offscreen API was introduced in Chrome 109. It allows Manifest V3 extensions to handle use cases that need interaction with the DOM or window, which cannot be performed in the extension service worker. Also, Chrome 114 introduced two additional offscreen reasons: 'WORKERS'
for instances when your document needs to spawn a worker and 'LOCAL_STORAGE'
to help migrate data from window.localStorage
to the chrome.storage
API.
Starting in Chrome 115, you can provide multiple reasons when creating an offscreen document. This allows you to perform two related tasks in the same document.
New Side Panel API 🎉
In the past, the only way to create sidebars in extensions was by injecting a new element with content scripts on every page. In Chrome 114, the Side Panel API was launched. Now you can develop a companion sidebar experience for users in a much more straightforward way. Read more about how the Side Panel API allows you to design a superior user experience.
More robust Service Workers
All extension events now restart the extension service worker's idle timer. In Chrome 110, the hard five-minute maximum lifetime was removed for extension service workers. Also, messages to native applications and messages within the extension restart the idle timer. Read more about it in The extension service worker lifecycle article.
More API launches
- Action API: Starting Chrome 110, you can customize the badge text with
setBadgeTextColor
() andgetBadgeTextColor()
. Also,isEnabled()
allows you to check if the action is enabled for the current tab. - Commands API: The bug where extension shortcuts, declared in the manifest under
"commands._execute_action"
, would not persist during conversion to MV3, was fixed in Chrome 111. - Downloads API: The default downloads UI in Chrome has moved from a shelf at the bottom to the right side of the omnibox. To disable this behavior, you can use
downloads.setUiOptions()
which replacessetShelfEnabled()
. - History API:
chrome.history.getVisits()
andchrome.history.search()
also return data from other devices that have been synced to the local history database. This may result in more history entries and higher visit counts.isLocal
was added toVisitItem
in Chrome 115 (expected in stable later this month) to be able to filter by local visits only. - Identity API: The authentication window now appears as a popup, instead of occupying a full application window. To grant more control during the process of JavaScript redirects, we have added two new options:
abortOnLoadForNonInteractive
andtimeoutMsForNonInteractive
. - Storage API: In Chrome 112 the
chrome.session
storage size was increased to 10MB. Thenchrome.local
storage size was changed to match in Chrome 114.
Coming soon...
Upcoming Chrome versions will introduce many features to make it easier for extensions to migrate to Manifest V3. For a list of upcoming MV3 migration-related changes, check out our known issues page. Additionally, we plan to add the following features:
- DeclarativeNetRequest API: The default value for the isUrlFilterCaseSensitive property will change to
false
. See the WECG thread. - The File Handling API will allow ChromeOS extensions to open files with specified MIME types and file extensions. This feature is currently behind a flag.
- Runtime API: We are releasing
runtime.getContexts()
to replaceextension.getViews()
, which is deprecated. This will allow extensions to determine if an extension page like the side panel or offscreen document is open. See the WECG proposal. - Service workers: We're adding strong keep-alives to Chrome APIs that display a user prompt:
permissions.request()
,desktopCapture.chooseDesktopMedia()
,identity.launchWebAuthFlow()
, andmanagement.uninstall()
. - Side Panel API: We're launching
sidepanel.open()
, which will open the extension side panel programmatically in response to a user gesture, such as a context menu click. - TabCapture API: We're adding the ability to call
getMediaStreamId()
from the extension service worker and obtain a MediaStream from a stream ID in an offscreen document. See Audio recording and screen capture for examples.
Stay tuned to the What's new in extensions page for these announcements as soon as they are made available in Chrome Beta.
Documentation upgrades and more Manifest V3 guidance
We've also been working hard to improve the developer's learning experience. Big thanks to all of you who took the time to ask questions on the chromium-group and report documentation issues on developer.chrome.com.
Highlights
- The new MV3 Migration section provides practical ways to convert Manifest V2 extensions to Manifest V3.
- The Extension service workers guide provides detailed information on extension service workers topics. These include how they are registered and updated, what the lifecycle looks like, how imports work, and more.
- The Handle events with service workers tutorial teaches the basics of extension service workers. It builds an omnibox extension that gives you quick access to extension API reference pages.
More updates
- Using Google Analytics 4 demonstrates how to track the usage of your extension popup and service worker events.
- Using geolocation shows how to obtain the geographical location of the extension using the Offscreen API.
- Audio recording and screen capture teaches how to capture audio and video from tabs, windows, or screens using
chrome.tabCapture
andnavigator.mediaDevices.getDisplayMedia()
APIs. - We've added new debugging tips to the Debugging extensions guide.
- We've updated the Permission warnings guidelines to make it easier to understand how permission warnings work and how you can provide a better user experience. Also, there are practical ways to check what warnings the user will see.
- Our team and contributors have also added new Manifest V3 extension samples: WASM in extensions, Scripting API demo, Side Panel API cookbooks, and DeclarativeNetRequest API samples. You can explore other extension samples in our GitHub samples repo.
Coming soon...
- How to migrate remote hosted code to Manifest V3.
- How to run automated tests for Chrome extensions.
- Improved Declarative Net Request guidance.
- Improvements to the content script explainer.
💡 Did you know?
Before we wrap up, we wanted to share a couple of useful tools and insights:
- Chrome started work on supporting WebHID; you can play around with the API starting Chrome 115 (but be aware that it's still a work in progress).
- Puppeteer now supports testing in headless mode using
--headless=new
. Read more about it on Chrome's headless mode upgrade blog post. - With the Extension Update Testing Tool, you can check what warnings are triggered when permissions change in the manifest. This way, you can experience the update process as a user would. This is important because some permissions might disable the extension until the user grants access again.
Let's connect! 🙌
This year, the extension team was happy to meet extension developers in person during Google I/O Connect events. We are working on creating new spaces to connect with you, such as launching focus groups and meetup events.
In the meantime, please continue to ask questions on the chromium-groups, consider participating on the WECG, and report any documentation issues on the developer.chrome.com GitHub repo.
Thanks again for being a part of the extension developer community!