Dup Goto 📝

DynamicallyLoadedJavascript

PT2/aw/lang/js 07-31 13:46:40
To Pop
12 lines, 41 words, 419 chars Monday 2023-07-31 13:46:40

You can add Javascript to a document via

new_script_element = document.createElement("script")
new_script_element.setAttribute("src","https://domain.com/path/to/hello.js")
document.body.append(new_script_element)

and to view it, using the developer tools:

scripts = Array.from(document.querySelectorAll("script"))
script[3] // appropriate index
// you can then view it in the console