我想使用javascript/jquery修改.txt(完全覆盖)。我目前使用下面编写的代码,它在IE中工作正常。使用javascript/jquery编辑txt文件
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile(dir + "modules.txt", 2, true, -2);
s.WriteLine(tobewritten);
s.Close();
fso = s = null;
如何在Mozilla Firefox中完成同样的工作。
请注意,我在本地运行我的应用程序,而不是托管在网络服务器上。
[在Firefox中,使用Javascript写入文件?](http://stackoverflow.com/questions/4284199/in-firefox-write-to-a-file-using-javascript) – CodingIntrigue
这是我认为IE中存在一个安全问题,你不能在其他任何地方这样做。 – ncm
如果这是可能的,任何人都可以编辑你的电脑上的任何文件。 – Joren