API > wxt > MainWorldContentScriptDefinition
Interface: MainWorldContentScriptDefinition
Contents
Extends
Properties
allFrames
allFrames?:
PerBrowserOption<undefined|boolean>
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
falseInherited from
MainWorldContentScriptEntrypointOptions.allFrames
Source
packages/wxt/src/option-types.ts:76
cssInjectionMode
cssInjectionMode?:
PerBrowserOption<"manifest"|"manual"|"ui">
Customize how imported/generated styles are injected with the content script. Regardless of the mode selected, CSS will always be built and included in the output directory.
"manifest"- Include the CSS in the manifest, under the content script'scssarray."manual"- Exclude the CSS from the manifest. You are responsible for manually loading it onto the page. Usebrowser.runtime.getURL("content-scripts/<name>.css")to get the file's URL"ui"- Exclude the CSS from the manifest. CSS will be automatically added to your UI when callingcreateShadowRootUi
Default
"manifest"Inherited from
MainWorldContentScriptEntrypointOptions.cssInjectionMode
Source
packages/wxt/src/option-types.ts:95
exclude
exclude?:
string[]
List of target browsers to exclude this entrypoint from. Cannot be used with include. You must choose one of the two options.
Default
undefinedInherited from
MainWorldContentScriptEntrypointOptions.exclude
Source
packages/wxt/src/option-types.ts:26
excludeGlobs
excludeGlobs?:
PerBrowserOption<undefined|string[]>
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
[]Inherited from
MainWorldContentScriptEntrypointOptions.excludeGlobs
Source
packages/wxt/src/option-types.ts:71
excludeMatches
excludeMatches?:
PerBrowserOption<undefined|string[]>
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
[]Inherited from
MainWorldContentScriptEntrypointOptions.excludeMatches
Source
packages/wxt/src/option-types.ts:61
include
include?:
string[]
List of target browsers to include this entrypoint in. Defaults to being included in all builds. Cannot be used with exclude. You must choose one of the two options.
Default
undefinedInherited from
MainWorldContentScriptEntrypointOptions.include
Source
packages/wxt/src/option-types.ts:19
includeGlobs
includeGlobs?:
PerBrowserOption<undefined|string[]>
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
[]Inherited from
MainWorldContentScriptEntrypointOptions.includeGlobs
Source
packages/wxt/src/option-types.ts:66
matchAboutBlank
matchAboutBlank?:
PerBrowserOption<undefined|boolean>
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
falseInherited from
MainWorldContentScriptEntrypointOptions.matchAboutBlank
Source
packages/wxt/src/option-types.ts:54
matchOriginAsFallback
matchOriginAsFallback?:
PerBrowserOption<boolean>
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
falseInherited from
MainWorldContentScriptEntrypointOptions.matchOriginAsFallback
Source
packages/wxt/src/option-types.ts:81
matches
matches?:
PerBrowserOption<string[]>
Inherited from
MainWorldContentScriptEntrypointOptions.matches
Source
packages/wxt/src/option-types.ts:44
registration
registration?:
PerBrowserOption<"manifest"|"runtime">
Specify how the content script is registered.
"manifest": The content script will be added to thecontent_scriptsentry in the manifest. This is the normal and most well known way of registering a content script."runtime": The content script'smatchesis added tohost_permissionsand you are responsible for using the scripting API to register/execute the content script dynamically at runtime.
Default
"manifest"Inherited from
MainWorldContentScriptEntrypointOptions.registration
Source
packages/wxt/src/option-types.ts:107
runAt
runAt?:
PerBrowserOption<undefined|"document_start"|"document_end"|"document_idle">
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
"documentIdle"Inherited from
MainWorldContentScriptEntrypointOptions.runAt
Source
packages/wxt/src/option-types.ts:49
world
world:
"MAIN"
See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
Inherited from
MainWorldContentScriptEntrypointOptions.world
Source
packages/wxt/src/option-types.ts:115
Methods
main()
main():
any
Main function executed when the content script is loaded.
When running a content script with browser.scripting.executeScript, values returned from this function will be returned in the executeScript result as well. Otherwise returning a value does nothing.
Source
packages/wxt/src/client-types.ts:32
Generated using typedoc-plugin-markdown and TypeDoc