faqts : Computers : Programming : Languages : JavaScript

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

36 of 60 people (60%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

How do I create a file on the Desktop using JScripts CreateTextFile?

Apr 4th, 2008 20:34
ha mo, Dave Clark, Colin Fraser, OneDogAmI,


Javascript does not allow you to create files on a user's computer, 
which for some reason some people seem to think is a fault in 
Javascript. However, when you consider that it also prevents some very 
clever clowns from taking over your computer and wrecking it, then 
this 
"lack" is perhaps more a virtue than a flaw. .
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OneDog,
     Since you specified JScript (not the more generic "JavaScript" 
term), nothing else needs to be said except to inform you that 
CreateTextFile (which is a method of MS "FSO" -- File System Object) 
cannot be used from an Internet-based web page.  The reason is due to 
security issues.  In their wisdom to also support intranets and local 
HTML document use, though, IE and JScript may use FSO locally as 
follows:
var fso = new ActiveXObject("Scripting.FileSystemObject");
     For more information, follow this link:
http://msdn2.microsoft.com/en-us/library/z9ty6h50.aspx
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com