addScriptTag
Injects a <script> tag into the page, either from a URL or from raw
content. When a URL is given the mutation resolves once the script has
loaded.
**Usage Example:**
mutation InjectScript {
goto(url: "https://example.com") {
status
}
addScriptTag(url: "https://code.jquery.com/jquery-3.7.1.min.js") {
time
}
}
**Field Definition:**
addScriptTag(
url: String
content: String
id: String
type: String
): AddScriptTagResponse
Arguments
addScriptTag.url ● String scalar
The URL of the script to add. One of "url" or "content" is required.
addScriptTag.content ● String scalar
The raw JavaScript content of the script to add. One of "url" or "content" is required.
addScriptTag.id ● String scalar
The id attribute to set on the injected script element
addScriptTag.type ● String scalar
The type attribute to set on the injected script element, eg: "module"
Type
AddScriptTagResponse object
Response returned after injecting a script tag