Click here to Skip to main content
13,197,548 members (51,521 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hi friends i am new to this blog, I am going to creating application like text editor using javascript, I am trying to create a new text file using ActiveXObject window method by clicking the button. Its creating a file but i want to create a new textfile when i clicked the button..
here the code which i used for creating file..
function createfile()
var file;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile("C:\Libraries\Documents\NewFile.txt", 8, true, 0);
please help me...
Posted 28-Mar-13 11:30am
Updated 9-Feb-17 23:22pm
richcb 28-Mar-13 17:32pm
I don't think Java Script has a WriteLine() method, it is just .Write.
ThePhantomUpvoter 28-Mar-13 17:42pm
If it is creating a file, which is what you want to do, then what is the problem?
Sergey Alexandrovich Kryukov 28-Mar-13 17:44pm
Do you think using ActiveX in HTML's JavaScript is at all acceptable? :-)
Member 9950476 29-Mar-13 14:47pm
i want to create multiple text files..

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

First of all, it's a really bad thing to use ActiveX object in JavaScript, virtually in all cases. This won't ever be supported by all browsers and platforms, and, more importantly, is utterly unsafe. If any experienced user will see that you are doing such things, such person will never use your products or products of your company, as it would suggest that such company does not consider very basic security practices.

And you really never need it for your purpose. As to the creation of the text editors, they can be pure JavaScrip tools working on all platforms. For example, look at this HTML (not just text) WYSIWYG editor:[^],[^].

You can look at the source code and get the basic ideas.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171020.1 | Last Updated 10 Feb 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100