Skip to content

API / wxt/utils/inject-script / injectScript

Function: injectScript() ​

injectScript(path, options?): Promise<InjectScriptResult>

Source: packages/wxt/src/utils/inject-script.ts:21

This function can only be called inside content scripts.

Inject an unlisted script into the page. Scripts are added to the <head> element or document.documentElement if there is no head.

Make sure to add the injected script to your manifest's web_accessible_resources.

Parameters ​

path ​

any

options? ​

InjectScriptOptions

Returns ​

Promise<InjectScriptResult>

A result object containing the created script element.


Generated using typedoc-plugin-markdown and TypeDoc