faqts : Computers : Programming : Languages : JavaScript : Document

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

339 of 482 people (70%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

Can I call the Save as command from client side JavaScript?
Can I call the Save as command from client side JavaScript?
Can I make the save as type to "Web Page, complete (*.htm;*.html)" by default when the dialog box op
Can I call the Save as command from client side JavaScript in NetscapeŽ Communicator?

May 6th, 2008 14:18
B Bell, Thor Larholm, Martin Honnen, Sanjeev Jain, khaishen tan,


With IE4 or higher you can use
  document.execCommand('SaveAs')
If you want to give a different default name in the SaveAs dialog box, 
you can use
  document.execCommand('SaveAs',null,'filename.html')
I would like to add a bit of kool knowledge to this information.  That 
is if you use the following command.  The default will be "Text File 
(*.txt)" in the "Save as Type" field.
  document.execCommand('SaveAs','1','filename.txt .txt')