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.

interface InjectDetails {
    allFrames?: boolean;
    code?: string;
    cssOrigin?: CSSOrigin;
    file?: string;
    frameId?: number;
    matchAboutBlank?: boolean;
    runAt?: RunAt;
}
Index
allFrames?: boolean

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.

code?: string

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

The css origin of the stylesheet to inject. Defaults to "author".

file?: string

JavaScript or CSS file to inject.

frameId?: number

The ID of the frame to inject the script into. This may not be used in combination with allFrames.

matchAboutBlank?: boolean

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

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