[Jslib] jslib include() for remote script

Pete Collins pete at mozdev.org
Wed Sep 17 21:10:22 EDT 2003

Ryan Maw wrote:
> I would like to use the include() method in jslib to load a script file 
> from a remote http server, for example:
> include("http://www.somedomain.net/myscript.js");
> I would like this script to be included into the script in my chrome 
> window so the functions that are in the script have full access to other 
> objects/functions in the chrome window, etc.  I have tried this but am 
> having problems.  Is this possible?
> If not, any ideas on how I might incorporate remote script into a chrome 
> window without using the <script src=..."/> tag?  I want the user of the 
> chrome app to be able to load in a script file after the app has 
> started.  I have tried setting the src="" attribute on a script tag but 
> this doesn't seem to work when the <script> tag is part of a chrome 
> window (it does seem to work when the tag is part of an html doc that is 
> loaded into a mozilla browser.)  Help!

Yea, I know how to implement this. But won't have time for a while.

But i think you can do something like this.

include (jslib_remotefile);

var rf = new RemoteFile("http://www.somedomain.net/myscript.js");
var jsfile;

if (rf.exists()) {
   jsfile = rf.read();


Pete Collins

More information about the Jslib mailing list