I just installed the latest version of Anki, and want to integrate JavaScript code for a card template.
I tested with the following simple test code in Front Template for one of my cards:
You can’t use window.onload or window.addEventListener(‘DOMContentLoaded’, …), because Anki desktop only updates a part of the DOM tree when displaying a card rather than refreshing the whole page.
(to clarify: js does work if you use things that are supported. I have custom card templates that use a lot of js and it works fine, same for a bunch of other users here)