window.open(downloadUrl, 'download_window', 'toolbar=0,location=no,directories=0,status=0,scrollbars=0,resizeable=0,width=1,height=1,top=0,left=0') I prefer this to the javascript window.open method because if the link is broken the iframe method simply doesn't do anything as opposed to redirecting to a blank page saying the file could not be opened. ![]() ![]() Var downloadFrame = document.createElement("iframe") ĭtAttribute('src',downloadUrl) ĭtAttribute('class',"screenReaderText") ĭ(downloadFrame) Ĭlass="screenReaderText" is my class to style content that is present but not viewable. I then did some xbrowser testing and have found that an iframe works best on all modern browsers IE>8. ![]() I've been looking for a good way to use javascript to initiate the download of a file, just as this question suggests.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |