|Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread|
|Messages 1 to 3 of 3 total|
|TBrowser - onLoad Event|
|Thu, Mar 23 2017 12:48 PM||Permanent Link|
In EWB2 we're using a THTMLForm & TBrowser to perform a http post for a file upload.
While it's uploading, as it may take a few moments for the server to send a response, I'm popping up a "please wait" form with a nice animated graphic so the user can see something is happening.
If the server response is then normal html, the TBrowser.OnLoad event fires, so I can hide the wait form from here and user continues working.
However, for some, we need the server to return a CSV file as the response, sending relevant headers
Content-Type: text/csv; charset=utf-8
Content-Disposition: attachment; filename="xxxxxxxxxx.csv"
.... which the browser then treats as a file download (which is fine)... but this means the TBrowser.OnLoad event doesn't appear to fire. I've re-created by simplifying to a http "get" on a csv file with the THTMLForm, and having the TBrowser.OnLoad event update a label with current time.
|Thu, Mar 23 2017 1:40 PM||Permanent Link|
Andrew Oborn wrote:
In my shop I poll for a status of order processing, and the response can be a simple status (number and message) or a redirect to tell the browser to go somewhere else. Depending on how much control you have, that might be an option, allowing you to control with more precision.
|Thu, Mar 23 2017 2:03 PM||Permanent Link|
Tim Young [Elevate Software]
Elevate Software, Inc.
Yeah, the browser won't fire an OnLoad for a file download. If you *know* that you're going to be downloading a file, then the suggestion mentioned here is a good idea:
(the one starting with "Setting headers server-side")
Namely, use a TServerRequest (AJAX) to initiate the download and have the server response with the URL for the download. Then, use a hidden TBrowser (iframe) to navigate to the download URL.