1

I'm writing a chrome extension using three.js and dom-to-image as libraries, and I am getting this error from dom to image:

Error while reading CSS rules from <random-link> SecurityError: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules.

Essentially what I require is a method of accessing a style sheet from another domain, but so far I haven't found a way of doing so. All I need to do is copy the csssheet and make it readable.

I have already tried try catches around the import statement.

Manifest.json:

{
  "name": "Inspect2",
  "description": "Inspect the page",
  "version": "2.0",
  "permissions": [
    "activeTab",
    "tabs",
    "notifications",
    "http://*/*",
    "https://*/*"
  ],
  "background": {
    "scripts": ["background.js"],
    "persistent": false
  },
  "browser_action": {
    "default_title": "..."
  },
  "manifest_version": 2
}
CoderMuffin
  • 519
  • 1
  • 10
  • 21
  • Possible duplicate of [Accessing cross-domain style sheet with .cssRules](https://stackoverflow.com/questions/3211536/accessing-cross-domain-style-sheet-with-cssrules) – wOxxOm Sep 07 '19 at 16:21
  • 1
    As shown in the linked topic you can download the url and assign the contents to a `style` DOM element (with its `disabled` property set to `true`). – wOxxOm Sep 07 '19 at 16:23

0 Answers0