JS Booster's update to 2.1 - Use external javascript

jpjpbj's Avatar


28 Sep, 2018 11:08 AM

I need to work with external javascript and I used to do it on 2.0 with the add-on "JS Booster".
Does somebody know how I can do it on 2.1? Do I need a similar add-on yet? If yes, is someone working in it?

  1. 1 Posted by Glutanimate on 28 Sep, 2018 12:31 PM

    Glutanimate's Avatar

    Anki 2.1 supports external JS natively, actually. You just need to make sure to put the files into your media collection.

    For cookie support you can either use Cookie Monster or the anki-persistence workaround.

    The one feature that hasn't been ported yet is reloading the web view between reviews, but for most use cases that will likely be unnecessary.

    However, if anyone is interested in having that ported over as well, just let me know and I'll be happy to look into it.

  2. 2 Posted by Björn on 26 Nov, 2018 10:42 AM

    Björn's Avatar


    I'm trying to use the enhanced cloze add-on in 2.1 but I got the the message that I don't have any cloze in the #content. Do you know how I can fix it?

    Best regards

  3. 3 Posted by Tak on 13 Nov, 2019 03:40 AM

    Tak's Avatar

    Am I missing something? I don't seem to be able to get external JS to work. I need to load 3 scripts and it goes like this:

    <script src = "_myscript01.js"></script>
    <script src = "_myscript02.js"></script>
    <script src = "_myscript03.js"></script>

    The scripts work perfectly on AnkiDroid and Anki 2.0, so the code shouldn't be the problem. Do you have any suggestions?

    Since Syncing will be discontinued on 2.0 in January, this is a pretty pressing matter for me :(

  4. 4 Posted by ijg on 13 Nov, 2019 02:30 PM

    ijg's Avatar


    The scripts work perfectly on AnkiDroid and Anki 2.0, so the code shouldn't be the problem.

    You can't infer this from your observation. Maybe the code has a problem with the way Anki 2.1 works so that it wouldn't work even if it were on your card templates ...

    You could search the anki subreddit for javascript. Maybe there are some relevant discussions, see e.g. https://www.reddit.com/r/Anki/comments/bk82ov/how_to_load_external_...

  5. 5 Posted by Tak on 13 Nov, 2019 10:36 PM

    Tak's Avatar

    You were absolutely right; turns out lines with the unfashionable and evil document.write() method was causing problems. It's all fixed now. Thanks for your reply :)

  6. 6 Posted by Chi on 15 Nov, 2019 05:51 PM

    Chi's Avatar

    Can someone plz help me I’m also having the same problem with my anki deck now that I switched to 2.1

  7. 7 Posted by fionnbharr hark... on 21 Jun, 2020 03:02 PM

    fionnbharr harkin's Avatar

    Late I know however I also had the same issue and found a solution that has worked well for me.

    instead of

    <script src = "_myscript01.js"></script>


        if (typeof hljs === "undefined") {
            var script = document.createElement('script');
            script.src = "_myscript01.js";
            script.async = false;

        var script = document.createElement('script');
        script.src = '_myscript01.js';
        script.async = false;

    for whatever reason, that has worked for me. just thought I would mention as it took me a while to get my cards working.

    edit: ijg actually posts a link to the subreddit where I found this but I will leave this comment regardless. he was suggesting this to load css but It seemed to fix my external js problems so go figure.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac