I am looking for an isolated piece of code that uses XmlHttpRequest/JavaScript to download files from a (specified path on a) server to local machine. The browser on the local machine (Mozilla/FireFox) does not require user interaction.
XMLHttpRequest / JavaScript to download files from server to local
Collapse
X
-
So you want your browser to download files and save them to the hard drive on your clients computer? And to top that, you want to do this without the user even being aware of it?
If so, then no mate. Never going to happen.
Could you imagine what would happen if web-developers could simply save stuff on your computer without you agreeing to it or even being aware of it? No computer connected to the internet would survive for more than a day.
No browser will ever give your client-side scripts access to the file-system. -
No, the device with the browser is not a client or customer machine, but a dedicated device to reproduce multimedia content. Basically it´s a media player. It is programmed not to require user interaction, as the only controller of the dedicated device is also the controller of the server. Can you not work with server sockets on both sides, so that the server always accepts requests from player and vice versa. The only thing missing then is still the code on how to do this (download file from server to player via HTTP).Originally posted by AtliSo you want your browser to download files and save them to the hard drive on your clients computer? And to top that, you want to do this without the user even being aware of it?
If so, then no mate. Never going to happen.
Could you imagine what would happen if web-developers could simply save stuff on your computer without you agreeing to it or even being aware of it? No computer connected to the internet would survive for more than a day.
No browser will ever give your client-side scripts access to the file-system.
Here goes some comment from the device/software manufacturer:
+++
There is a way to do that [..initiate download from player]. That way is a standard way for Mozilla (or Firefox) based browsers.
You can use TCP sockets in your JavaScript applications like you usually do in C or any other general purpose language. See http://www.xulplanet.com/tutorials/mozsdk/sockets.php
You even can use server sockets in JavaScript. See http://www.xulplanet.com/tutorials/m...serverpush.php
You also can access local file system. See http://developer.mozilla.org/en/Code.../File_I%2f%2fO
You can also take a look at Mozilla jslib http://jslib.mozdev.org/
All this code requires interaction with user to ask him if he allows to perform the operation. In our player-browser [Mozilla/Firefox] this interaction is not required.
All these operations are allowed by default.
+++
The thing is I am just not a programming expert, and want only to have the right code to execute this operation.
Thanks a lot.Comment
-
you can use flash for sockets.
you can load remote files into variables, but you cannot save them on the local machine.
although in firefox and IE8, you can store up to 5mb of data using window.globalSt orage.
you can store 10mb w/o permission by tunneling into flash.Comment
-
I don't know that which server side technology you are using. But if u are trying it in PHP then at first you have to make a request to your server using XMLHttpRequest object and on the server end you have to read that file's content using readfile() function. Then you should set some headers like content-type, pragma and Cache-control etc and finally echo that content on your web page using PHP 'echo' .Comment
Comment