extensionTypes.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.

Type

Values of this type are objects. They contain the following properties:

codeOptional
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.
fileOptional
string. JavaScript or CSS file to inject.
allFramesOptional
boolean. If allFrames is true, implies that the JavaScript or CSS should be injected into all frames of the current page. By default, it's false and is only injected into the top frame.
matchAboutBlankOptional
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. The code cannot be inserted in top-level about:-frames. By default it is false.
runAtOptional
extensionTypes.RunAt. The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle".

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?45.0Yes33
Firefox
Basic support48.0

Acknowledgements

This API is based on Chromium's chrome.extensionTypes API. This documentation is derived from extension_types.json in the Chromium code.

Document Tags and Contributors

 Contributors to this page: wbamberg, rolfedh
 Last updated by: wbamberg,