8000 Adding styles to sites with strict CSP · Issue #12 · erosman/firemonkey · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Adding styles to sites with strict CSP #12
Open
@deevroman

Description

@deevroman

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

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

      0