# \[SOLVED\] HTML / CSS engine in Reviewer doesn't work like in Browser

**URL:** <https://forums.ankiweb.net/t/solved-html-css-engine-in-reviewer-doesnt-work-like-in-browser/16185>\
**Category:** Help\
**Created:** [December 26, 2021, 6:54pm UTC](https://forums.ankiweb.net/t/solved-html-css-engine-in-reviewer-doesnt-work-like-in-browser/16185 "2021-12-26T18:54:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zarathustraed](https://avatars.discourse-cdn.com/v4/letter/z/b487fb/32.png) [@Zarathustraed](https://forums.ankiweb.net/u/Zarathustraed)\
**Post date:** [December 26, 2021, 6:54pm UTC](https://forums.ankiweb.net/t/solved-html-css-engine-in-reviewer-doesnt-work-like-in-browser/16185/1 "2021-12-26T18:54:20Z")

</div>

Hello, there seems to be a problem with Anki and how it handles HTML functions and css. I noticed the problem in 2.1.49 and then tried all versions until there was no problem. There seems to be a difference between 2.1.40 and 2.1.41, in which the HTML and CSS are handled differently in the Reviewer than the Card Preview in Browser.

Platform:macOS 10.15.7 and macOS 12.1  
Version works: 2.1.40  
Version doesn’t work as expected: ≥ 2.1.41  
Add-ons: none

Here are the screenshots of the two versions, the HTML front and back, as well as the CSS to check the problem yourself. Any help is appreciated. Please request anything else if you need it.

[̶L̶̶̶i̶̶̶n̶̶̶k̶̶̶ ̶̶̶t̶̶̶o̶̶̶ ̶̶̶D̶̶̶r̶̶̶o̶̶̶p̶̶̶b̶̶̶o̶̶̶x̶̶̶ ̶̶̶w̶̶̶i̶̶̶t̶̶̶h̶̶̶ ̶̶̶N̶̶̶o̶̶̶t̶̶̶e̶̶̶.̶̶̶a̶̶̶p̶̶̶k̶̶̶g̶̶̶,̶̶̶ ̶̶̶H̶̶̶T̶̶̶M̶̶̶L̶̶̶s̶̶̶ ̶̶̶a̶̶̶n̶̶̶d̶̶̶ ̶̶̶C̶̶̶S̶̶̶S̶̶̶](https://www.dropbox.com/sh/3qrcge01eeju732/AADnuPSJNiLNe06f1EU9bARaa?dl=0)

 ![2.1.40](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/4/4a56c5d881bc6a2bdc80aeb60ad8ff054bd0afd7.jpeg)  
 ![2.1.41](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/c/c9a840d77996f6df7db3f39b355a5939282de409.jpeg)

---

<div class="post-metadata">

**Author:** ![kleinerpirat](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/kleinerpirat/32/19863_2.png) [@kleinerpirat](https://forums.ankiweb.net/u/kleinerpirat)\
**Post date:** [December 26, 2021, 9:29pm UTC](https://forums.ankiweb.net/t/solved-html-css-engine-in-reviewer-doesnt-work-like-in-browser/16185/2 "2021-12-26T21:29:38Z")

</div>

Nice design!

2.1.41 brought persistence to the main window’s reviewer, but the browser previewer still refreshes the whole document when flipping to the backside, it seems. A brief inspection with trusty [AnkiWebView Inspector](https://ankiweb.net/shared/info/31746032) revealed the following errors:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/1/1de49942e17b98412676684875b217540db6f2c0.png)

You need to assign `scroll_to_cloze` to a `var` instead of `let` to prevent the `SyntaxError`. From now on, you should use `var` for declarations on the uppermost level of a `<script>`, because `var` isn’t block-scoped, but function-scoped, in contrast to `const` and `let`, both of which will cause errors now:

> Variables declared by `var` keyword are scoped to the immediate function body (hence the function scope) while `let` variables are scoped to the immediate _enclosing_ block denoted by `{ }` (hence the block scope).

From: [javascript - What is the difference between "let" and "var"? - Stack Overflow](https://stackoverflow.com/questions/762011/whats-the-difference-between-using-let-and-var)

That `SyntaxError` messed up the whole script block of your function definitions, resulting in the `ReferenceError` for `footNotes`.

---

<div class="post-metadata">

**Author:** ![Zarathustraed](https://avatars.discourse-cdn.com/v4/letter/z/b487fb/32.png) [@Zarathustraed](https://forums.ankiweb.net/u/Zarathustraed)\
**Post date:** [December 26, 2021, 10:43pm UTC](https://forums.ankiweb.net/t/solved-html-css-engine-in-reviewer-doesnt-work-like-in-browser/16185/3 "2021-12-26T22:43:16Z")

</div>

I can’t believe how simple this was, but it’s mainly because I lack knowledge of javascript!

Thank you, the design is not mine though. I couldn’t reach the creator though for more than a month, so you were my last resort. Thank you for the solution, I can now use the v3 scheduler as well, along with all the improvements!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [May 1, 2023, 4:38am UTC](https://forums.ankiweb.net/t/solved-html-css-engine-in-reviewer-doesnt-work-like-in-browser/16185/4 "2023-05-01T04:38:48Z")

</div>


