Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

extensionTypes.InjectDetails

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!

This object is used by:

The code can be in a separate file, specified using file, or in a string, specified using code. One (and only one) of code or file must be set.

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

Type

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

allFramesOptional
boolean. If true, the code will be injected into all frames of the current page. If it is false, code is only injected into the top frame. Defaults to false.
codeOptional
string. Code to inject, as a text string.
fileOptional
string. Path to a file containing the code to inject. In Firefox, relative URLs are resolved relative to the current page URL. In Chrome, these URLs are resolved relative to the add-on's base URL. To work cross-browser, you can specify the path as an absolute URL, starting at the add-on's root, like this: "/path/to/script.js".
frameIdOptional
integer. The frame where the code should be injected. Defaults to 0 (the top-level frame).
matchAboutBlankOptional
boolean. If true, the code will be injected into embedded "about:blank" and "about:srcdoc" frames if your add-on has access to their parent document. The code cannot be inserted in top-level about: frames. Defaults to false.
runAtOptional
extensionTypes.RunAt. The soonest that the code will be injected into the tab. Defaults to "document_idle".

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic Support Yes Yes 45.0 48.0 No

Compatibility notes

Firefox

  • 'matchAboutBlank' is not supported.

Acknowledgements

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

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

ドキュメントのタグと貢献者

 このページの貢献者: wbamberg, Jeremie, glukki, rolfedh
 最終更新者: wbamberg,