chrome.extensionTypes

Description: The chrome.extensionTypes API contains type declarations for Chrome extensions.
Availability: Since Chrome 39.

Summary

Types
ImageFormat
ImageDetails
RunAt
CSSOrigin
InjectDetails

Types

ImageFormat

The format of an image.
Enum
"jpeg", or "png"

ImageDetails

Details about the format and quality of an image.
properties
enum of "jpeg", or "png" (optional) format

The format of the resulting image. Default is "jpeg".

integer (optional) quality

When format is "jpeg", controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease.

RunAt

The soonest that the JavaScript or CSS will be injected into the tab.
Enum
"document_start", "document_end", or "document_idle"

CSSOrigin

The origin of injected CSS.
Enum
"author", or "user"

InjectDetails

Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.
properties
string (optional) code

JavaScript or CSS code to inject.

Warning:
Be careful using the code parameter. Incorrect use of it may open your extension to cross site scripting attacks.

string (optional) file

JavaScript or CSS file to inject.

boolean (optional) allFrames

If allFrames is true, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's false and is only injected into the top frame. If true and frameId is set, then the code is inserted in the selected frame and all of its child frames.

integer (optional) frameId

Since Chrome 50.

The frame where the script or CSS should be injected. Defaults to 0 (the top-level frame).

boolean (optional) matchAboutBlank

If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is false.

enum of "document_start", "document_end", or "document_idle" (optional) runAt

The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle".

enum of "author", or "user" (optional) cssOrigin

Since Chrome 66.

The origin of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to "author".