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.

Invalid HTML on card: SecurityError: Failed to execute 'insertRule' on 'CSSStyleSheet': Cannot access StyleSheet to insertRule

See original GitHub issue

Hei there!

I downloaded the Incremental Reading add-on (v4103). I was trying to follow the instructions under the usage in the README file. I added a link but when I open up the deck I end up with the below error message.

Screenshot 2020-10-31 at 8 44 59 AM

I could reproduce this by

  1. Copy https://en.wikipedia.org/wiki/Incremental_reading
  2. Then paste it in after Alt+3.
  3. Open the deck

I am running Anki:

Version 2.1.36 (53a984ba)
Python 3.8.0 Qt 5.14.2 PyQt 5.14.2

On macOS v10.15.7 (19H2).

Thanks.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
AlexRiinacommented, Jan 6, 2021

I think you can fix this issue by commenting out the javascript in the width.js file

// if (screen.width > {maxWidth}) {{
//     var styleSheet = document.styleSheets[0];
//     styleSheet.insertRule(
//         "div {{ width: {maxWidth}px; margin: 20px auto }}", 0
//     );
// }}

https://github.com/luoliyan/incremental-reading/blob/master/ir/web/width.js

0reactions
tvhongcommented, Oct 9, 2022

I’m trying it now and cannot reproduce.

My system info:

Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
Platform: Mac 11.6.2
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-10-09 10:19:20


===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Incremental Reading v4113 unofficial clone ['999215520', 2022-09-27T16:32, 'None', '']

===IDs of active AnkiWeb add-ons===
999215520

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Read more comments on GitHub >

github_iconTop Results From Across the Web

Chrome 64 Uncaught DOMException: Failed to execute ...
Getting this message in console: Uncaught DOMException: Failed to execute 'insertRule' on 'CSSStyleSheet': Cannot access StyleSheet to ...
Read more >
CSSStyleSheet.insertRule() - Web APIs | MDN
The CSSStyleSheet.insertRule() method inserts a new CSS rule into the current style sheet.
Read more >
Failed to execute 'insertRule' on 'CSSStyleSheet': 2 arguments ...
What went wrong? In console errors: Uncaught TypeError: Failed to execute 'insertRule' on 'CSSStyleSheet': 2 arguments required, but only 1 present.
Read more >
SyntaxError Occurs in the Browser - Documentation - Telerik
Uncaught SyntaxError: Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule' in Chrome. SyntaxError: An invalid or illegal string was ...
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, ... to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules....
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