PDA

View Full Version : Download data received by server push during https connection



famedoro
12-28-2015, 06:17 PM
A Web page use a server push technology to send continuously an update to my web browser page, to which I have previously authenticated via https.

Is it possible to write a Javascript code in order to download the data provided from the server web page sent using https using the credential already provided in another Firefox tab ?

Beverleyh
12-28-2015, 07:39 PM
JavaScript alone cannot download data from the server. You would need to incorporate a server-side language, such as PHP, in order to communicate with the server via your web page (e.g. A timed post request to a PHP file sent via Ajax?)

As for communication between browser tabs/windows (from the same domain), it's possible - although I've never personally tried - but you can start your research here https://www.google.co.uk/search?q=communication+between+browser+tabs

molendijk
12-28-2015, 10:56 PM
It depends on what you mean by 'download'. If you just mean 'show the data', you could use an iframe or a text/html-object.

famedoro
12-29-2015, 08:06 AM
Thanks to Beverleyh and molendijk for answers.
The browser already receives continually updated data from the server in push mode. I would like to save in a file (in append mode) all received data.
Correct me if I'm wrong !

Beverleyh
12-29-2015, 09:10 AM
What data are we talking? If it's text-based, you can automate a dump into Excel or something (I believe I saw that mentioned when I posted the Google link before), or save it to Local Storage, or show it on screen as molendijk suggested (text-based content is, or can be made to be, harmless, so that would be easier to get on to a local computer in an automated fashion), but with a file download, which could be an .exe or something else potentially harmful, there is usually a browser prompt for a user to respond to; confirm download and save location type-of-thing. As a browser security feature, I'm not sure you can circumvent that - let's face it, if you could, spam-kiddies would be downloading nasty stuff on to everyone's computers. Another option could be to automate an email and send whatever data to a dedicate email client, but still, the physically act of moving it from web to your local computer is likely to require human intervention.


I guess the questions you should answer in order to begin more targeted research are;

- What do you mean by 'download'? / what kind of 'download'?
- what data/file format are you attempting to download?
- where does the downloaded data end up?

famedoro
12-29-2015, 09:29 AM
The data are text-based data which the browser continuously receive and it allows the update of a table in a browser web page. I would like to save the flow of textual data the the server send - "push" - to the browser.

The browser is connected to a server in https, which through push technology as the data changes send text updates to the web page. I'd like to save to a local text file these data.

The received data are like these:

1Last#PRC#0#0#SEDCORR#LAST
#2 1Var.%#VAR#0#1#SEDCORR#
#DESCRIPTION#0 1
#PRC###SEDCORR#REFERENCE_PRICE#0 1
#TXT#5#1#SYSTEM#PHASE#0 1Ora#DTE#0#7#SEDCORR#TIME_LAST

which will then be formatted from the webpage in appropriate table.


What data are we talking? If it's text-based, you can automate a dump into Excel or something (I believe I saw that mentioned when I posted the Google link before), or save it to Local Storage, or show it on screen as molendijk suggested (text-based content is, or can be made to be, harmless, so that would be easier to get on to a local computer in an automated fashion), but with a file download, which could be an .exe or something else potentially harmful, there is usually a browser prompt for a user to respond to; confirm download and save location type-of-thing. As a browser security feature, I'm not sure you can circumvent that - let's face it, if you could, spam-kiddies would be downloading nasty stuff on to everyone's computers. Another option could be to automate an email and send whatever data to a dedicate email client, but still, the physically act of moving it from web to your local computer is likely to require human intervention.


I guess the questions you should answer in order to begin more targeted research are;

- What do you mean by 'download'? / what kind of 'download'?
- what data/file format are you attempting to download?
- where does the downloaded data end up?

Beverleyh
12-29-2015, 09:53 AM
Ok, so it sounds like you have the answers to begin your research.

So, maybe start at the end and work backwards in stages? First try Googling "how to save data from the server to a local text file", assess if what you want to do is actually possible, try out a few tutorials or script snippets and take it from there.

If you need further help, please post *your code* and then folks here can chip in with suggestions.

Alternatively, if you'd like somebody to write the code for you, you can hire a developer or post a request in the General Paid Work Requests forum http://www.dynamicdrive.com/forums/forumdisplay.php?30-General-Paid-Work-Requests