composeScripts API

This compose scripts API is the same as the content scripts API except that it works on the document of email messages during composition.

See also executeScript, insertCSS, removeCSS, and messageDisplayScripts API.

Note

Registering a compose script in the manifest.json file is not possible at this point.

Permissions

sensitiveDataUpload

Transfer sensitive user data (if access has been granted) to a remote server for further processing

Note

The permission compose is required to use messenger.composeScripts.*.

Functions

register(composeScriptOptions)

Register a compose script programmatically. Note: Registered scripts will only be applied to newly opened message composer tabs. To apply the script to already open message composer tab, manually inject your script by calling executeScript([tabId], details) for each of the open messageCompose tabs.

Parameters

composeScriptOptions

Required permissions

  • compose

Types

RegisteredComposeScript

An object that represents a compose script registered programmatically.

object

  • unregister() Unregister a compose script registered programmatically.

RegisteredComposeScriptOptions

Details of a compose script registered programmatically.

object

[css]

(array of ExtensionFileOrCode, optional)

The list of CSS files to inject.

[js]

(array of ExtensionFileOrCode, optional)

The list of JavaScript files to inject.

External Types

The following types are not defined by this API, but by the underlying Mozilla WebExtension code base. They are included here, because there is no other public documentation available.

ExtensionFileOrCode

Specify code, either by pointing to a file or by providing the code directly. Only one of the two is allowed.

object

code

(string)

Some JavaScript code to register.

file

(string)

A URL starting at the extension’s manifest.json and pointing to a JavaScript file to register.