Ankiweb: Show media from url in samples for shared decks

When using a tag like <img src=""> it works just fine in the deck itself. However, when sharing the deck, the images don’t show up in the samples and also AnkiWeb says the deck has 0 images.

Example deck

Would be useful to add the media using urls for decks where downloading would take up too much space.

As for why it does not show the image in samples for shared decks, I can only guess this is for security reasons (cards could contain arbitrary code that would be executed on anyone’s browser who looks at the sample, as if it was, which is certainly no good), but there is a good reason for which these images are not counted in the media count: Anki does not take into account images that are generated / downloaded on the fly at rendering time, simply because it would be impossible (arbitrary code could be executed, so the only way for Anki to know would be to actually make the rendering, and check for any image in the DOM; however, that would still not be enough, because a script could show an image when the user clicks on a button for example, so Anki would still be wrong).


Yeah that makes a lot of sense. I suppose it is a bit more complicated than I had first imagined.

I strongly recommend you do not use external references in your cards, as they will break when the website goes down or moves things around.

1 Like

Not everyone here has the same point of view on this… @kleinerpirat

1 Like

I can just update the deck if that happens. The problem is I have a shared deck with 100 GB worth of media so I kind of have to use references.

I would never hardcode a reference.

You’re referring to the post where I shared a script that looks up arbitrary words from an online dictionary. The only hard-coded part are the CSS selectors and the URL, which can be easily updated in the template (or switch the dictionary altogether).

It’s not really about hardcoding a reference, it’s more about having references to external websites at all (instead of a local copy). But I understand some people cannot store all these references, and that some people never work offline (or rarely).

Personally, I would never do that. Relying on fetching internet resources that I could simply mirror locally is what triggers my OCDs :stuck_out_tongue: but I guess in my case storage space is not an issue…

1 Like