Answer the question
In order to leave comments, you need to log in
How to make code work in extension context?
The task is as follows:
1. There is a content_script that works on each page and its task is to load js code from a remote server, and then insert the script into the tag
function AddScriptToPage(code, name) {
let script = document.createElement('script')
script.setAttribute('type', 'text/javascript')
script.setAttribute('hash', 'sha256-CihokcEcBW4atb/CW/XWsvWwbTjqwQlE9nj9ii5ww5M=')
script.setAttribute('d-name', name)
script.innerText = code
document.querySelector('body').append(script)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question