2017-07-21 117 views
-1

定義我有很多困難,試圖解決一個的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(); 
} 

任何想法從哪裏開始?

回答

1

這是因爲Google Chrome和Mozilla Firefox(以及Microsoft Edge)不支持ActiveXObject,並且永遠都不會。 ActiveX在現代Web瀏覽器中沒有地位。

只有IE支持ActiveXObject,即使如此,更新版本的IE只支持它與一個對象的子集(我不認爲FileSystemObject是其中之一)。

至於從網頁在本地機器的文件系統上創建一個文本文件:不,你不能這樣做。 (除了安全禁用的IE舊版本。)

相關問題