How to add javascript files that are located elsewhere to custom-theme?

Ok, I’ve managed to add local javascript files using theme’s description.xml by adding file-element with name-attribute.

But there is no documentation or examples on adding javascript that is located eg in src=“”. I don’t want to copy that file to theme folder because that file gets frequent updates.


Here’s two possible solutions:

  1. Add separate index-file where you set that javascript (example for this can be found from )

  2. Add this javascript file to theme-folder and add it to description.xml.

var heads = document.getElementsByTagName("head");
var script = document.createElement('script');