faqts : Computers : Programming : Languages : JavaScript : Links

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

31 of 36 people (86%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

Can I call save as on a linked document?

Apr 30th, 2000 08:26
Martin Honnen, Mark Neal,


While IE5 allows to call
  document.execCommand('SaveAs')
(see
http://www.faqts.com/knowledge-base/view.phtml/aid/1829/fid/124)
on the currently loaded document it doesn't provide a direct way to 
call save as on a link. 
So for documents like images which the browser usually displays all you 
can do is open a window with the image and call the above on the opened 
window. See
http://www.faqts.com/knowledge-base/view.phtml/aid/2009/fid/122/lang/
for an example.
For files the browser can't display (e.g. .zip files) and usually 
offers to save you can use
http://www.faqts.com/knowledge-base/view.phtml/aid/2202/fid/126/lang/
to allow the user to download/save such files.
I don't know of client side JavaScript methods to simple download/save 
a document of a type the browser knows to display (e.g. html and image 
files). You will always have a window involved.