Failed to load media with Javascript template

14 views
Skip to first unread message

jonathan wrede

unread,
Mar 17, 2021, 8:39:02 AM3/17/21
to AnkiDroid
Hey I'm the author of the "Markdown and KaTeX Support" Add-on for Anki (https://ankiweb.net/shared/info/1087328706) and I'm trying to implement support for AnkiDroid, but I'm having some Issues.

I loaded all .js and .css files I need via a python script into the collections.media folder and load them from my Anki template, if the file doesn't exist I load them from a CDN, which works great on PC.
I then sync my collections.media folder with AnkiDroid and all files are transfered correctly but if I load a card with my template I still get the Error message "Card Content Error: Failed to load '_katex.css'".

I load the .css file via: <link rel="stylesheet" href="_katex.css" onerror="this.href='https://cdn.jsdelivr.net/npm/ka...@0.12.0/dist/katex.min.css';" crossorigin="anonymous">

If you need any more information please tell me!

jonathan wrede

unread,
Mar 17, 2021, 10:07:28 AM3/17/21
to anki-a...@googlegroups.com
I got rid of it by dynamically loading the css into the template with this: https://stackoverflow.com/questions/25767089/adding-a-stylesheet-dynamically

--
You received this message because you are subscribed to a topic in the Google Groups "AnkiDroid" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/anki-android/AHbdIJiaauU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to anki-android...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/anki-android/5e05f7df-02d1-4ac8-8f99-ce39b5172cd9n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages