Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can't return 2 responses to 1 request. You can return only 1 response to 1 request. A file download counts as one response and a redirect counts as another response.</p> <p>Your best bet is to return a response which automatically initiates a new request in some way. The second response can then be returned to this automatically initiated request. JavaScript is very helpful in this with functions like <code>window.location</code> (to fire a new request in current window), <code>window.open()</code> (to fire a new request in a new window), and <code>form.submit()</code> (to submit a POST form).</p> <p>The simplest way would be to redirect to the target page wherein some JavaScript is conditionally rendered (and immediately executed) which in turn triggers the file download by e.g. <code>window.location</code> or <code>form.submit()</code>. The <code>window.open()</code> is inappropriate if the download itself is already set as an attachment. Note that this approach doesn't redirect <em>after</em> the user has saved the file download, this is plain impossible as there's no client side event to hook on when the last bit of the download is saved. Instead, the redirect is first performed and then the file download.</p> <p>If you've really a hard head in this, then you can always create an applet or webstart application which fully manages the saving of the downloaded file, so that you can easily perform a redirect after the last bit is saved. However, this is IMO plain clumsy (and even potentially bad for UX; for instance I personally hate this kind of "download managers" on several websites).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload