Open
Description
I'm trying to add to the site openstreetmap.org new styles using the following script:
// ==UserScript==
// @name Test JS
// @match https://www.openstreetmap.org/*
// @grant GM_addElement
// @inject-into content
// @version 1.0
// ==/UserScript==
console.log("begin");
GM_addElement(document.head, "style", {
textContent: `
* {
background: red !important;
}
`,
});
console.log("end");
This works in Tampermonkey and Violentmonkey, but doesn't work in FireMonkey. I've heard that TM relaxes page CSP, but what about VM? Does it relax CSP too?
I also noticed that FM allows to add custom styles to the page, and they are successfully applied on openstreetmap.org. And this suggests that in theory, userscripts could have a similar API. For example, GM_addStyle could use it, and not just be a wrapper over GM_addElement. Are there any obstacles to this?
Metadata
Metadata
Assignees
Labels
No labels