173
Views
6
Comments
How to redirect to a page after a Download?
Question
Hi guys, 

I need the user to be redirect after it downloads a file. The scenario is: The user clicks on a button, the file is downloaded and right after a message is displayed and the page is redirected. Ive already tried a lot of things, but my scripts are not being executed when I put the Download endpoint in my action...

How can I achieve this? any ideas?
2014-10-29 17-38-35
Kayala Sunil
André - I sincerely think you must be using the client side redirect.
From a preparation, the easyest way is using as destination a "ExternalSite" instead of the screen directly and The GetEntryURL is a method from the HTTPRequestHandler extension. Just do a Add Remove References to add it.

To make it work you might have to clear the cache of your browser and the temp system %temp%


Another thing you can use the action MakeAbsoluteUrl()  on the extension HTTPRequestHandler
to garantee that your URL is always right in every environment ;)

2017-10-09 20-45-22
André Siébra
Kayala Sunil wrote:
André - I sincerely think you must be using the client side redirect.
From a preparation, the easyest way is using as destination a "ExternalSite" instead of the screen directly and The GetEntryURL is a method from the HTTPRequestHandler extension. Just do a Add Remove References to add it.

To make it work you might have to clear the cache of your browser and the temp system %temp%


Another thing you can use the action MakeAbsoluteUrl()  on the extension HTTPRequestHandler
to garantee that your URL is always right in every environment ;)
 
 Hi Kayala. I've tried to redirect by this way.. no success. It's like João said, it is not possible with a single page/action since the browser seems to kill my scripts at the expense to download...



 
2012-03-16 12-21-09
João Rosado
Staff
Hi,

There are a couple topics on the forum regarding the subject.
The bottom line is: the way browsers handle downloads it is not possible with a single page/action.
That is why almost all sites redirect to pages with "download starting in a few seconds" as workarounds.

This topic has a solution like that.
There are also some solutions that involve having having javascript clicking and invisible link, but they are a bit tricky and browser dependent. I've seen some bowsers in the past just abort all javascript running in the page when they get a download ...so that breaks most solution attempts that do not involve extra pages/tabs/iframes.

Regards,
João Rosado

2017-10-09 20-45-22
André Siébra
João Rosado wrote:
Hi,

There are a couple topics on the forum regarding the subject.
The bottom line is: the way browsers handle downloads it is not possible with a single page/action.
That is why almost all sites redirect to pages with "download starting in a few seconds" as workarounds.

This topic has a solution like that.
There are also some solutions that involve having having javascript clicking and invisible link, but they are a bit tricky and browser dependent. I've seen some bowsers in the past just abort all javascript running in the page when they get a download ...so that breaks most solution attempts that do not involve extra pages/tabs/iframes.

Regards,
João Rosado
 
 João, I've already tried the insvisible link trick, but as you well said, no success.. I'll take a look at that topic or try the second page workaround. 

Thanks!
 
2014-10-29 17-38-35
Kayala Sunil
André - then I think we must use some sort of javascript which can be called in for the event... Sometimes very simple operations takes hellava time in OS... 
2016-04-21 20-09-55
J.
 
MVP
err no,

like joao said. redirecting after a download is not simple by default.
Nothing to do with outsystems

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.