的ReferenceError:ActiveXObject的在Chrome和Mozilla
问题描述:
定义我有很多困难,试图解决一个的ReferenceError的:的ReferenceError:ActiveXObject的在Chrome和Mozilla
ActiveXObject is not defined in Google Chrome.
function WriteToFile()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.CreateTextFile("/var/www/html/nodejsphp/Test.txt",true);
s.WriteLine('messages');
console.log("contents of file now'some sampletext'");
s.Close();
}
任何想法从哪里开始?
答
这是因为Google Chrome和Mozilla Firefox(以及Microsoft Edge)不支持ActiveXObject
,并且永远都不会。 ActiveX在现代Web浏览器中没有地位。
只有IE支持ActiveXObject
,即使如此,更新版本的IE只支持它与一个对象的子集(我不认为FileSystemObject
是其中之一)。
至于从网页在本地机器的文件系统上创建一个文本文件:不,你不能这样做。 (除了安全禁用的IE旧版本。)