Click to See Complete Forum and Search --> : Include remote file


OhLordy
05-30-2003, 07:28 AM
How can I include a remote file with javascript?
Thanks
Rob

AdamBrill
05-30-2003, 07:30 AM
You can include an external .js file like this:

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

OhLordy
05-30-2003, 07:51 AM
What if it's not a javascript file?

Charles
05-30-2003, 09:16 AM
Originally posted by OhLordy
What if it's not a javascript file? Then it will not work. If the file in question is a full HTML document then use an IFRAME or OBJECT element. If it is a fragment and the two files are on the same server use something like SSI. If they are on different servers then use SSI and Perl.

<!--#include virtual="cgi-bin/myInclude.pl" -->

And as your script "myInclude.pl" use something like:

#!user/local/bin/perl
use CGI qw(header);
use LWP::Simple;
print header, get ('http://www.someFragment.com/');