I trying to add a script to my Xul application at runtime, with:
document.write('<script type="text/javascript" src="chrome://myapp/content/myscript.js"/>');
but I got:
Error: document.write is not a function
The function does exist in the docs. I got also this example from the docs:
document.open();
document.write("<h1>Out with the old - in with the new!</h1>");
document.close();
but I got:
document.open is not a function
Any idea what's wrong?
--update
Maybe I could put my js code in a Javacript Module and import it with Components.utils.import (looking for where to put the resource and how to reference it)