本文介绍了JavaScript ActiveXObject的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 在javascript中我有一个关于ActiveXObject的queastion。我已经在Mozila FireFox 6.0.2中尝试了这段代码。 var AXobj = new ActiveXObject(WScript.Shell); AXobj.SendKeys(key); 但错误控制台说ActiveXObject是未定义的。在这之后,我试了一下: var AXobj = new DOMParser(WScript.Shell); AXobj.SendKeys(key); 但是,错误控制台说: 错误:未被捕获的异常:[Exception ...Security errorcode:1000nsresult:0x805303e8(NS_ERROR_DOM_SECURITY_ERR)location:file:/// C:/ Documents%20and %20Settings / Guest / Desktop / stuff / html / GML%20to%20JS.html Line:335] 我不想只用于SendKeys ActiveXObject。我需要它更多的东西(如写在文件中...),而我使用FireFox而不是IE浏览器的原因是,FireFox支持HTML5。解决方案 它仅适用于IE( thank goodness ) 。 它也有一些严重的安全问题,这是其他浏览器供应商从未采用的一个重要原因。 I have a queastion about ActiveXObject in javascript. I have tryed this code in Mozila FireFox 6.0.2 var AXobj = new ActiveXObject("WScript.Shell");AXobj.SendKeys(key);But the error console says that ActiveXObject is undefined. After that, I have tryed this:var AXobj = new DOMParser("WScript.Shell");AXobj.SendKeys(key);But then, the error console says: Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "file:///C:/Documents%20and%20Settings/Guest/Desktop/stuff/html/GML%20to%20JS.html Line: 335"]By the way, i don't want to use ActiveXObject only for SendKeys. I need it for more stuff (like writing in file... ) AND, the reason i use FireFox instead of IE is that FireFox supports HTML5. 解决方案 ActiveX is a proprietary technology only supported by Microsoft...It will only work in IE (thank goodness).It also has some serious security concerns which is a big reason it was never adopted by other browser providers. 这篇关于JavaScript ActiveXObject的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-23 02:11