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=“http://mycompany.org/scripts/poll.js”. I don’t want to copy that file to theme folder because that file gets frequent updates.

Thanks!

Here’s two possible solutions:

  1. Add separate index-file where you set that javascript (example for this can be found from http://forum.itmill.com/posts/list/163.page )

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


var heads = document.getElementsByTagName("head");
var script = document.createElement('script');
script.setAttribute("src","http://mycompany.org/scripts/poll.js");
script.setAttribute("type","text/javascript");
heads[0]
.appendChild(script);