banjoman Posted January 27, 2006 Share Posted January 27, 2006 I have created a button that will enable the reader of my webpage to download a zip file from my site<button onClick="java script:window.open('relative link to file');">download</button>using IE and Firefox this will open an open/save option windowbut it also, of course, opens a blank webpage, which is a bit inconvenient!is there a script that will enable a file download without opening a blank webpage window?which is the best, most efficient way of enabling a user to download a file? what are the alternatives? Link to comment Share on other sites More sharing options...
aspnetguy Posted January 27, 2006 Share Posted January 27, 2006 try <input type="button" value="download" onclick="window.location='relative path to file'"/> Does this work???You could also have a hidden iframe on the page and when the button is click have the src of the iframe chaneg tot he file for download....this gets rid of the need for popup windows and should start the download without changeing to another page. Link to comment Share on other sites More sharing options...
banjoman Posted January 31, 2006 Author Share Posted January 31, 2006 that code works a treat, thanks very much Link to comment Share on other sites More sharing options...
aspnetguy Posted January 31, 2006 Share Posted January 31, 2006 you are very welcome Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now