Skip to content

Script injection code affected by CSP #4

Description

@olfek

function inject() {
browser.storage.local.get().then(store => {
let javascript = store[location.host]
if (!javascript) {
return
}
let script = document.createElement("script")
script.id = id()
script.textContent = javascript
document.body.append(script)
})
}

... is affected by CSP -
https://developer.mozilla.org/docs/Web/HTTP/CSP

I recommend using the browser.scripting API instead -
https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/scripting/executeScript

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions