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.
views:
64answers:
3
+2
A:
You could put a hidden iframe
on the page and target
that. (or use javascript to generate one dynamically).
Alconja
2010-05-14 01:31:55
Great! Why didn't I think of that?
Evgeny
2010-05-14 02:03:15
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
2010-05-14 01:32:26
A:
You could try a meta refresh
<meta http-equiv="refresh" content="2;url=http://path.to/file.download">
Ben Rowe
2010-05-14 01:35:26