Reputation: 61971
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.
Upvotes: 1
Views: 993
Reputation: 28711
You could try a meta refresh
<meta http-equiv="refresh" content="2;url=http://path.to/file.download">
Upvotes: 0
Reputation: 80744
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'
Upvotes: 0
Reputation: 14873
You could put a hidden iframe
on the page and target
that. (or use javascript to generate one dynamically).
Upvotes: 2