composeScripts API
The composeScripts API allows to register and unregister scripts for the message compose window.
Manifest file properties
compose_scripts
Scripts and CSS to inject into compose windows.
message_display_scripts
Scripts and CSS to inject into message display pages.
Permissions
The following permissions influence the behavior of the API. Depending on which permissions are requested, additional methods might be available, or certain data may be included in responses.
Hint
Request permissions only when needed. Unnecessary requests may result in rejection during ATN review.
compose
Read and modify your email messages as you compose and send them.
Functions
register(composeScriptOptions)
– [Added in TB 82]
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.
Required permissions
Types
ComposeScript
– [Added in TB 151]
A script and/or CSS to inject into compose windows via the manifest.
Note
The run_at option is not supported for compose scripts, because the compose editor does not load content in the same way as a regular web page.
object
css
The list of CSS files to inject.
js
The list of JavaScript files to inject.
ExtensionFileOrCode
Specify code, either by pointing to a file or by providing the code directly. Only one of the two is allowed.
object
file
A URL relative to the extension’s manifest.json file, and pointing to a JavaScript file to register.
or
object
code
A string of JavaScript code to register.
ExtensionURL
A path relative to the root of the extension.
string
MessageDisplayScript
– [Added in TB 151]
A script and/or CSS to inject into message display pages via the manifest.
object
css
The list of CSS files to inject.
js
The list of JavaScript files to inject.
run_at
RegisteredComposeScript
– [Added in TB 82]
An object that represents a compose script registered programmatically.
object
RegisteredComposeScriptOptions
– [Added in TB 82]
Details of a compose script registered programmatically.
object
css
The list of CSS files to inject.
js
The list of JavaScript files to inject.