[thelist] Content-Disposition filename and delayed download

Bill Moseley moseley at hank.org
Sat Dec 4 08:03:23 CST 2010

On Fri, Dec 3, 2010 at 6:12 AM, Bill Moseley <moseley at hank.org> wrote:

> What's the recommended approach to the filename used in downloads?  I would
> like to allow users to specify the filename (or, say, use an existing
> user-provided name or title) which means I'd likely need to encode in utf-8.
>  But, I'm not sure what conclusion to draw from looking at
> http://greenbytes.de/tech/tc2231/

Well, I looked at what Google Apps does and when downloading it turns
non-ASCII characters into an underscore.  Either Google took the easy way
out or it's perhaps not possible to send a non-ASCII filename that works for
all browsers.

Any suggestions on how to detect and close a window that's polling with meta
refresh?  Say the window refreshes every 2 seconds and when the download is
ready returns it (application/pdf with Content-Disposition attachment).
 Will something as simples as this work in the meta refresh window?

    setTimeout(window.close, 5000);

Any risk of interrupting the download if the window is closed before its
fully downloaded?

> Now, say I have to dynamically generate the download and it might take
> longer than a normal web request.  In the past I've opened another window
> and used a meta refresh to poll the server until the download is ready.
>  Seems a bit old-school.
> Can anyone point me to an example of a better approach?  I've seem
> suggestions of using iframes or polling with AJAX.
> I've also see suggestions that it's important to not set no-cache headers
> for IE when sending the download.
> I'm not quite clear if I want to send Connection: close when polling.  The
> idea is I don't want to hold up a web server process when the client is
> polling for the download, but the load balancer should allow for keep-alive
> connection on the client side but not tie up a single web server process.
> --
> Bill Moseley
> moseley at hank.org

Bill Moseley
moseley at hank.org

More information about the thelist mailing list