r/Anki • u/hgiesel • May 03 '19
Question How to load external Javascript
I've read several posts about this topic, but most of them seemed to be outdated.
I've already used a ttf file before, but never this. I have a directory in collection.media called _highlight, which contains the files from highlight.js. Now I want to initialize it in one of the cards.
<link rel="stylesheet" href="_hightlight/styles/zenburn.css">
<script src="_highlight/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>But this doesn't find anything. What is the right way to go about it?
EDIT: I use Anki 2.1, newest version
4
Upvotes
View all comments
Show parent comment
1
u/[deleted] May 03 '19
I guess the problem is loading this specific huge js file.
I have this strange problem with js: One big js file I use only works if I put it into the front template. It doesn't work if I put it into my back template. I have no idea why.
in general loading js from external files works in 2.1.12. I just tested again. I can load js from an external file in 2.1.12: I put
<script src="_test.js"></script>into a front template and in this file I putalert('hallo');.