Loading external javascript file

The script element to load external (local) javascript works properly on Anki (desktop) but fails on AnkiMobile (iOS), as follows:

<script src="_script.js" type="text/javascript"></script>

What exactly is causing this issue? Is there a some kind of limitation on the iOS side? Am I missing something?

I do not have a problem of this code not working. I could copy and paste the same functions across various card templates, but it would be nice to be able to share functions via single file. More than anything, I just want to know what is causing this particular issue. Thanks in advance.

1 Like

Does changing the source to ./_script.js help? I see this is the pattern used in the AnKing note types and some forum posts here, though I’m not sure if it’s needed, but it’s worth a try.

I did try ./scriptjs. No avail. I think it has to do with a loading timing, but I am not sure.

Files in the collection media may not update correctly if overwritten directly, so the Anki Tooltip add-on first deletes the .js file before adding the new .js file.