天天看點

javascript異常:”automation伺服器不能建立對象“ 處理

 最近使用javascript打開用戶端程式時,抛出一個異常,現已解決,和大家一起共享一下。

程式:

function runExecutable(executableFullPath)

{

//var executableFullPath = 'F://ZK//DownLoadFile//YodaoDict.exe';

try

{

var shellActiveXObject = new ActiveXObject("WScript.Shell");

if ( !shellActiveXObject )

{

alert('Could not get reference to WScript.Shell');

return;

}

shellActiveXObject.Run(executableFullPath, 1, false);

shellActiveXObject = null;

}

catch (errorObject)

{ //異常

alert(errorObject.message);

}

}

解決辦法:把IE的安全設定調為中等,并且把activeX控件和插件的“對為标記為可安全執行腳本的ActiveX控件初始化并執行腳本” 選項設定為啟用或者提示即可。

繼續閱讀