欢迎 What's new in Chrome extensions Get help with Chrome extensions API reference Samples
欢迎 What's new in Chrome extensions Get help with Chrome extensions API reference Samples

chrome.extensionTypes

  • Description

    The chrome.extensionTypes API contains type declarations for Chrome extensions.

Summary

Types

CSSOrigin

Chrome 66+

The origin of injected CSS.

Type

"author"

, or

"user"

DeleteInjectionDetails

Chrome 87+

Details of the CSS to remove. Either the code or the file property must be set, but both may not be set at the same time.

Properties

  • allFrames

    boolean optional

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

  • code

    string optional

    CSS code to remove.

  • cssOrigin

    CSSOrigin optional

    The origin of the CSS to remove. Defaults to "author".

  • file

    string optional

    CSS file to remove.

  • frameId

    number optional

    The frame from where the CSS should be removed. Defaults to 0 (the top-level frame).

  • matchAboutBlank

    boolean optional

    If matchAboutBlank is true, then the code is also removed from about:blank and about:srcdoc frames if your extension has access to its parent document. By default it is false.

DocumentLifecycle

Chrome 106+

The document lifecycle of the frame.

Type

"prerender"

,

"active"

,

"cached"

,
or

"pending_deletion"

FrameType

Chrome 106+

The type of frame.

Type

"outermost_frame"

,

"fenced_frame"

,
or

"sub_frame"

ImageDetails

Details about the format and quality of an image.

Properties

  • format

    ImageFormat optional

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

  • quality

    number optional

    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.

ImageFormat

Chrome 44+

The format of an image.

Type

"jpeg"

, or

"png"

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

  • allFrames

    boolean optional

    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.

  • code

    string optional

    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.

  • cssOrigin

    CSSOrigin optional

    Chrome 66+

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

  • file

    string optional

    JavaScript or CSS file to inject.

  • frameId

    number optional

    Chrome 50+

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

  • matchAboutBlank

    boolean optional

    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.

  • runAt

    RunAt optional

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

RunAt

Chrome 44+

The soonest that the JavaScript or CSS will be injected into the tab.

Type

"document_start"

,

"document_end"

,
or

"document_idle"

We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.