question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to access cssRules property DOMException: "CSSStyleSheet.cssRules getter: Not allowed to access cross-origin stylesheet"

See original GitHub issue

Bug reports:

My project uses Angular 9.1.0 and SCSS files and every time I attempt to convert an HTML element to canvas I get the following error

Unable to access cssRules property DOMException: "CSSStyleSheet.cssRules getter: Not allowed to access cross-origin stylesheet"

Does anyone know how to get around CORS in this case?

Specifications:

  • html2canvas version tested with: 1.0.0-rc.5
  • Browser & version: Firefox 74.0.1
  • Operating system: Windows 10 Pro

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

3reactions
querkmachinecommented, Apr 19, 2020

I was having this problem with my Vue-powered project in Firefox 75.0 (macOS 10.15.3).

Weirdly, I my project doesn’t have any cross-origin stylesheets, so I went and debugged where it was tripping over and found that it was trying to read in styles that had been injected by the Ghostery browser extension. Might be worth disabling your extensions and see if that’s the cause of the problem?

2reactions
mayanksdudakiyacommented, Mar 1, 2022

Faced the same issue on Ubuntu 20.04.3 LTS, Firefox 96. Disabled all extensions and it started working (didn’t have ghostery).

I have disabled all extensions and working fine now. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSSStyleSheet.cssRules getter: Not allowed to access cross ...
With a chrome driver I get the error error reading property . I am trying to get the document.styleSheets of a page, but...
Read more >
How to Fix the “Failed to Read the CSSRules Property From ...
If your CSS Stylesheet is from the same domain as the HTML, you will be able to access the document.styleSheets.get(index).cssRules property ...
Read more >
Issue with CSSRule Plugin (DOMException) - GSAP
cssRules getter : Not allowed to access cross-origin stylesheet" ... read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules
Read more >
Accessing some font's "CSS" style sheet via styleSheet throws ...
Steps to reproduce Go to https://webkit.org/blog/ Open the developer console. Enter document.styleSheets[1].cssRules.
Read more >
I can't download my blocks as image at all!
"Uncaught DOMException: CSSStyleSheet.cssRules getter: Not allowed to access cross-origin stylesheet line 9 > injectedScript:36". more details:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found