mlse
11-22-2006, 05:53 PM
Hi all,
I need to write a bit of javascript that can read the contents of an external file (e.g. http://www.mydomain.com/myscript.php) and insert it into a web page (e.g. http://www.myotherdomain.com/mypage.html).
I envisage something simple in mypage.html like:
.
.
<script language="javascript" type="text/javascript">
data = js_readfile("http://www.myotherdomain.com/myscript.php");
document.write(data);
</script>
.
.
That seems really simple and what I'm asking for (in a particularly long-winded way!) is the javascript equivalent of the PHP function readfile (referred to as js_readfile in the example).
Clearly it could not be *exactly* like the PHP readfile function or this would create an obvious security risk! I imagine it to be a function which will attempt only to read from qualified sources (i.e. webservers, ftp servers, etc), which are authorised to publish data.
TIA,
Mike.
I need to write a bit of javascript that can read the contents of an external file (e.g. http://www.mydomain.com/myscript.php) and insert it into a web page (e.g. http://www.myotherdomain.com/mypage.html).
I envisage something simple in mypage.html like:
.
.
<script language="javascript" type="text/javascript">
data = js_readfile("http://www.myotherdomain.com/myscript.php");
document.write(data);
</script>
.
.
That seems really simple and what I'm asking for (in a particularly long-winded way!) is the javascript equivalent of the PHP function readfile (referred to as js_readfile in the example).
Clearly it could not be *exactly* like the PHP readfile function or this would create an obvious security risk! I imagine it to be a function which will attempt only to read from qualified sources (i.e. webservers, ftp servers, etc), which are authorised to publish data.
TIA,
Mike.