I'm working on my first pylons app, and part of it allows a user
to download a file. Following the example in ch.6 of the Pylons Book,
that is working ok. I can successfully select a file and have it
download to my desktop.
I would like to be able to redirect the user to another page after
the download has been initiated, or at least put up a "yay, it's
finished" page, but that doesn't appear to be possible. So I was
wondering what it is that one normally does in a case like this? What
I've been able to find suggests that it is necessary to open a
separate window...does that sound right? Or is there a better way?
Pointers to any generic documentation on how to do this would be
appreciated; pointers to pylons-specific documentation (or recipes)
would be even better.
On Thu, Oct 29, 2009 at 10:32 AM, daysyn <jtb...@daylight.com> wrote:
> Hello,
> I'm working on my first pylons app, and part of it allows a user > to download a file. Following the example in ch.6 of the Pylons Book, > that is working ok. I can successfully select a file and have it > download to my desktop. > I would like to be able to redirect the user to another page after > the download has been initiated, or at least put up a "yay, it's > finished" page, but that doesn't appear to be possible. So I was > wondering what it is that one normally does in a case like this? What > I've been able to find suggests that it is necessary to open a > separate window...does that sound right? Or is there a better way?
I don't think you can do this except maybe with Javascript. Browsers usually switch pages based on a link on the page or a redirect in the HTTP headers (with a 3xx status). Neither of these are feasable with downloads.
On Thu, Oct 29, 2009 at 3:12 PM, Mike Orr <sluggos...@gmail.com> wrote:
> > I would like to be able to redirect the user to another page after > > the download has been initiated, or at least put up a "yay, it's > > finished" page, but that doesn't appear to be possible. So I was
What about turning it around; put up your "yay" page and then initiate the download via script or a meta tag. Maybe make the "yay" message more like "download should be coming now..."
On Oct 29, 2:16 pm, Matt Feifarek <matt.feifa...@gmail.com> wrote:
> On Thu, Oct 29, 2009 at 3:12 PM, Mike Orr <sluggos...@gmail.com> wrote:
> > > I would like to be able to redirect the user to another page after
> > > the download has been initiated, or at least put up a "yay, it's
> > > finished" page, but that doesn't appear to be possible. So I was
> What about turning it around; put up your "yay" page and then initiate the
> download via script or a meta tag. Maybe make the "yay" message more like
> "download should be coming now..."
> I think Mike is right; there is no way to embed instructions for the browser
> into a downloaded file.
Ok, thanks to you both. After further searching, it does seem like
Javascript would be required to make it more dynamic in the way I was
originally thinking.
Having the "yay" page come up and then automatically start the
download would be fine, though I assume that would mean I would have
to temporarily leave the sheltering embrace of pylons for the script.
I guess I could also just put a "Done" button somewhere below the
"download" button and have the user click that to move on.
Anyway, thank you for the responses. Knowing what is and isn't
possible seems to be half the battle sometimes.
On Fri, Oct 30, 2009 at 8:49 AM, daysyn <jtb...@daylight.com> wrote: > Having the "yay" page come up and then automatically start the > download would be fine, though I assume that would mean I would have > to temporarily leave the sheltering embrace of pylons for the script. > I guess I could also just put a "Done" button somewhere below the > "download" button and have the user click that to move on.
Somehow this issue doesn't come up on other sites. I'm not sure if you have unusual requirements or you're not considering all the UI possibilities. Maybe it's because when people download something, they're either done with the site (e.g., for a tarball) or want to remain on the same page (e.g., for a PDF link).
Perhaps the most succulent way would be a redirect HTML page (3xx) that says, "Your download will begin shortly. <Click here> if it doesn't. <Continue onward / Return to product summary>". The redirect would cause the download to automatically start, but would not move from the page. The page would technically be an error message, but if you use your regular site template it will have all the logos and menus people expect, so it'll look like a regular page.
On Fri, Oct 30, 2009 at 1:06 PM, Mike Orr <sluggos...@gmail.com> wrote: > Somehow this issue doesn't come up on other sites. I'm not sure if > you have unusual requirements or you're not considering all the UI > possibilities. Maybe it's because when people download something,
daysyn, don't forget the old-fashioned <META> that redirects/refreshes! I think that's commonly used, and isn't javascript.
On Sun, Nov 1, 2009 at 9:08 AM, Matt Feifarek <matt.feifa...@gmail.com> wrote: > On Fri, Oct 30, 2009 at 1:06 PM, Mike Orr <sluggos...@gmail.com> wrote:
>> Somehow this issue doesn't come up on other sites. I'm not sure if >> you have unusual requirements or you're not considering all the UI >> possibilities. Maybe it's because when people download something,
> daysyn, don't forget the old-fashioned <META> that redirects/refreshes! I > think that's commonly used, and isn't javascript.
Will that work with downloads? What if the download isn't finished by the refresh timeout?
Thanks again for your illuminating responses. As you have no doubt
surmised, most of the problem is that I don't know what I'm doing!
I'm not doing anything esoteric; I'm just a re-noob whose last serious
foray into web apps was with cgi/perl over ten years ago. So I'm sure
that the things I want to do are pretty standard...it is just that I'm
woefully ignorant. Having said that, I've found Pylons a fairly
comfortable ride, and put up most of the app without too many issues.
I did note Matt's suggestion of the META tag in an earlier email, but a
quick google search didn't yield anything that I was able to connect
with downloading. But as you've indicated that this is a common
solution, I will take a better look this time around. I don't mind
reading documentation; sometimes the problem is not knowing enough to be
able to ask the right question.
Mike's suggestion about the redirect is also interesting, and
immediately made sense.
I appreciate the pointers!
On Sun, 2009-11-01 at 12:08 -0500, Matt Feifarek wrote:
> On Fri, Oct 30, 2009 at 1:06 PM, Mike Orr <sluggos...@gmail.com>
> wrote:
> Somehow this issue doesn't come up on other sites. I'm not
> sure if
> you have unusual requirements or you're not considering all
> the UI
> possibilities. Maybe it's because when people download
> something,
> daysyn, don't forget the old-fashioned <META> that
> redirects/refreshes! I think that's commonly used, and isn't
> javascript.
On Mon, Nov 2, 2009 at 9:14 AM, Tim Bock <jtb...@daylight.com> wrote:
> I did note Matt's suggestion of the META tag in an earlier email, > but a > quick google search didn't yield anything that I was able to connect > with downloading. But as you've indicated that this is a common