API > wxt/utils/inject-script > injectScript
Function: injectScript()
injectScript(
path
,options
?):Promise
<InjectScriptResult
>
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
A result object containing the created script element and the return value of the script.
Source
packages/wxt/src/utils/inject-script.ts:23
Generated using typedoc-plugin-markdown and TypeDoc