开发者

JavaScript ActiveXObject

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... "Secur开发者_运维问答ity 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.


For this you can check if it is IE then do this otherwise do that.

Like:

Function exampleFunction()
{
if ($.browser.msie) { /* IE */
                //Your code

            else {
                //Your code
            }
}

just a suggestion.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜