Condividi tramite


Supported APIs

Note

This documentation is for extensions for the legacy version of Microsoft Edge. For information on the new Microsoft Edge, see Microsoft Edge (Chromium) Extensions.

Important

The new Microsoft Edge program is now open to accept chromium-based extensions for the new Microsoft Edge (v77 or later). If you want to submit a new extension, visit Publish to Microsoft Edge (Chromium) Add-ons Store to learn about the submission process.

With this announcement, Microsoft is no longer accepting new extensions for the legacy version of Microsoft Edge. If you own an Extension for the legacy version, you should begin the process of porting your Extension to the new Microsoft Edge. The new Microsoft Edge is based on Chromium, so Extensions designed for the legacy version of Microsoft Edge do not work with the new version.

The following is a detailed list of API members that are supported. Development of the extension platform is ongoing, so check back frequently for updates!

Note

  • For Microsoft Edge, all extension APIs are under the browser namespace, e.g. browser.browserAction.disable().
  • Microsoft Edge extension APIs use callbacks, not promises.

Overarching issues

The following known issues span across the extension platform and will be fixed in the near future:

  • When using the CSS url() property, absolute URLs using ms-browser-extension:// will not work like they do in Chrome. To bypass this issue, use relative paths to resources (starting in the root extension directory) instead.
  • window.open() does not work in extension background scripts. Please use browser.windows.create() instead.
  • Shared cookies are supported, however the extension background script will not have access to session cookies set in the tab before the extension is enabled. This issue does not affect persistent cookies.
  • If only unsupported permissions are specified for an extension, i.e activeTab, attempting to sideload the extension will result in the extension being uninstalled with the following message displayed: "Something went wrong with your extensions, so we had to reinstall them. You'll need to turn them on again."
  • Triggering a download via a hidden anchor tag will fail from background scripts. This should be done from an extension page instead.

bookmarks

The following bookmarks APIs are supported:

API Known issues Chrome incompatibilities
bookmarks
bookmarks.create
bookmarks.remove
bookmarks.getTree
bookmarks.move
bookmarks.removeTree
bookmarks.update

browserAction

The following browserAction APIs are supported:

API Known issues Chrome incompatibilities
browserAction
browserAction.disable
browserAction.enable
browserAction.getBadgeBackgroundColor
browserAction.setBadgeBackgroundColor
browserAction.onClicked
browserAction.setBadgeText
browserAction.setPopup
browserAction.getBadgeText
browserAction.setIcon browserAction.setIcon is not persisted.

The imageData parameter is not supported.

path is a required parameter.
browserAction.getTitle
browserAction.setTitle

contextMenus

The following contextMenus APIs are supported:

API Known issues Chrome incompatibilities
contextMenus
contextMenus.ContextType "page_action" ContextType will not show up in the page action context menu. Microsoft Edge does not support the "launcher" ContextType.
contextMenus.create When extensions do not provide a contextmenuid, the id generated is not unique.
contextMenus.onClicked
contextMenus.remove
contextMenus.removeAll
contextMenus.update

cookies

The following cookies APIs are supported:

API Known issues Chrome incompatibilities
cookies
cookies.get
cookies.getAll If no URL is provided, cookies are retrieved only for URLs in currently opened tabs. In Chrome, this gets all cookies on a user's machine.
cookies.getAllCookieStores Always returns the same default cookie store with ID "0". All cookies belong to this store.
cookies.onChanged Not supported.
cookies.remove
cookies.set

extension

The following extension APIs are supported:

API Known issues Chrome incompatibilities
extension
extension.getBackgroundPage
extension.getURL
extension.getViews
extension.isAllowedIncognitoAccess
extension.inIncognitoContext

i18n

The following i18n APIs are supported:

API Known issues Chrome incompatibilities
i18n
i18n.getAcceptLanguages
i18n.getMessage i18n.getMessage with invalid key throws exception instead of failing gracefully.

i18n.getMessage argument expects strings, but should also allow an int or throw an exception.
i18n.getUILanguage

idle

The following idle APIs are supported:

API Known issues Chrome incompatibilities
idle
idle.setDetectionInterval
idle.queryState

notifications

The following notifications APIs are supported:

API Known issues Chrome incompatibilities
notifications
notifications.NotificationOptions
notifications.TemplateType
notifications.clear
notifications.create
notifications.getAll
notifications.update
notifications.onButtonClicked
notifications.onClicked
notifications.onClosed
notifications.onPermissionLevelChanged
notifications.getPermissionLevel

pageAction

The following pageAction APIs are supported:

API Known issues Chrome incompatibilities
pageAction
pageAction.getPopup
pageAction.getTitle
pageAction.hide
pageAction.onClicked
pageAction.setIcon The imageData parameter is not supported.

path is a required parameter.
pageAction.setPopup
pageAction.setTitle
pageAction.show

runtime

The following runtime APIs are supported:

API Known issues Chrome incompatibilities
runtime
runtime.port.disconnect
runtime.port.onDisconnect
runtime.port.postMessage
runtime.connect
runtime.connectNative
runtime.id
runtime.getBackgroundPage
runtime.getManifest
runtime.getURL
runtime.lastError
runtime.reload
runtime.sendMessage Microsoft Edge extension pages can use runtime.sendMessage/onMessage to send messages to themselves.

runtime.sendmessage is not supported from site pages.
Microsoft Edge does not support the options parameter.
runtime.sendNativeMessage
runtime.setUninstallUrl
runtime.onConnect
runtime.onInstalled
runtime.onMessage tab object in runtime.onMessage event is not fully implemented. MessageSender.tlsChannelId is not supported in Microsoft Edge.

storage

The following storage APIs are supported:

API Known issues Chrome incompatibilities
storage
storage.local.get
storage.local.remove
storage.local.set
storage.local.clear
storage.local.getBytesInUse storage.local data is persisted in a different format than Chrome, causing a different value to be returned when calling storage.local.getBytesInUse.

Ex: storage.local.set({ "k": { "s": "âas" } } returns 13 in Chrome and 50 in Microsoft Edge.
storage.sync.get If the combined amount of characters in the name and author manifest fields exceed 31 characters the storage.sync namespace may not function.
storage.sync.remove
storage.sync.set
storage.onChanged

tabs

The following tabs APIs are supported:

API Known issues Chrome incompatibilities
tabs
tabs.captureVisibleTab
tabs.create selected, pinned, and openerTabId are not supported.
tabs.detectLanguage
tabs.executeScript runAt is ignored, though checked. Executing script in a specific frame is not yet supported.
tabs.get Options pages, when asking about a tab not in their window, fail this call.
tabs.getCurrent
tabs.insertCSS runAt is ignored, though checked. cssOrigin is not supported.
tabs.onActivated
tabs.onAttached
tabs.onCreated
tabs.onDetached
tabs.onRemoved
tabs.onReplaced
tabs.onUpdated After uninstall/reinstall, the URL is not received until Microsoft Edge is restarted.
tabs.query pinned, audible, and muted are not yet supported.

"popup" windowType is not yet supported.
highlighted is not supported.

"panel", "app", and "devtools" windowType are not supported.
tabs.reload Microsoft Edge does not support promises.
tabs.remove
tabs.sendMessage Messaging a specific frame is not yet supported. tabs.sendMessage never sends a response after a tab refresh if no runtime.onMessage listeners are present on the receiving tab.
tabs.Tab audible, mutedInfo, inPrivate, width, and height properties are not yet supported. openerTabId, selected, and highlighted properties are not supported.
tabs.update pinned and muted are not yet supported. highlighted and selected are not supported.

webNavigation

The following webNavigation APIs are supported:

API Known issues Chrome incompatibilities
webNavigation Tab ids are incorrect. Filtering, TransitionTypes and TransitionQualifiers not supported.

For a tab, all processIds will be the same.
webNavigation.getAllFrames Does not include object-as-iframe elements.
webNavigation.getFrame
webNavigation.onBeforeNavigate
webNavigation.onCommitted
webNavigation.onCompleted
webNavigation.onCreatedNavigationTarget
webNavigation.onDOMContentLoaded
webNavigation.onErrorOccurred
webNavigation.onHistoryStateUpdated
webNavigation.onReferenceFragmentUpdated
webNavigation.onTabReplaced Not supported.
webNavigation.TransitionType
webNavigation.TransitionQualifier

webRequest

The following webRequest APIs are supported:

API Known issues Chrome incompatibilities
webRequest webRequest not supported for synchronous XmlHttpRequests. Network requests from extensions, such as options, background or popup pages, are not supported.

Network requests from <object> and <embed> elements are not supported.

Headers cannot be modified for cached requests.
handlerBehaviorChanged Handler changes are automatically handled in Microsoft Edge.

Calling this has no effect.
onAuthRequired
onBeforeRedirect
onBeforeRequest requestBody is not supported.
onBeforeSendHeaders
onCompleted
onErrorOccurred
onHeadersReceived
onResponseStarted
onSendHeaders

windows

The following windows APIs are supported:

API Known issues Chrome incompatibilities
windows Window objects do not support alwaysOnTop property in Microsoft Edge.

InPrivate is not supported.
windows.CreateType "panel" and "detached_panel" are not supported in Microsoft Edge.
windows.create tabId parameter for tearing off a tab is not supported.
windows.get
windows.getAll windows.getAll({populate: true}) is missing tabs property.
windows.getCurrent
windows.getLastFocused
windows.update Specifying position is not supported. "minimized"/"maximized"/"fullscreen" and drawAttention are not supported in Microsoft Edge.
windows.onCreated WindowType filter is not supported.
windows.onFocusChanged WindowType filter is not supported.
windows.WindowState "minimized","maximized", "fullscreen" are not supported. "docked" is not supported in Microsoft Edge.
windows.WindowType "panel", "app", and "devtools" are not supported in Microsoft Edge.
windows.WINDOW_ID_CURRENT
windows.WINDOW_ID_NONE