views:

64

answers:

3

I've got an ASP.NET page that takes a long time to download and returns partial results as it's loading (as per my previous question). On the page I have some links to download files, ie. the response headers contain "Content-Disposition: attachment", so that the browser doesn't navigate away from the page. However, if the user clicks one of these links while the page is still loading it stops loading - normal behaviour, but not what I want in this case. I can get around that by adding target=_"blank" to the links, but this momentarily opens a new window and the closes it again (once the browser realises it's an "attachment"). Is there any way to avoid having those links stop the current page load without this new window trick? JavaScript is OK.

+2  A: 

You could put a hidden iframe on the page and target that. (or use javascript to generate one dynamically).

Alconja
Great! Why didn't I think of that?
Evgeny
A: 

Not sure it if will help, but try to add an iframe to the page and have your links do document.getElementById('your_iframe').location = 'your_url'

Fyodor Soikin
A: 

You could try a meta refresh

<meta http-equiv="refresh" content="2;url=http://path.to/file.download"&gt;
Ben Rowe