Tom McDonald
Tom McDonald

Reputation:

How to Detect IE7/IE8 "run as administrator" mode with Javascript

How to Detect IE7/IE8 "run as administrator" mode with Javascript? I have a html page that needs to be run in administrator mode.

I can detect if it is ie8/7 and when that occurs I pop-up an alert saying the user must be in administrator mode for the page to work (because it runs an active-x that doesn't work other wise). That, however, cause confusion when the user comes back to the page in admin mode and they get the same alert message.

Upvotes: 1

Views: 1129

Answers (2)

dev-null-dweller
dev-null-dweller

Reputation: 29462

Just an idea: use try and catch

try{
    var x = new ActiveXObject("SomethingSomething.DarkSide");
}
catch(e){
    alert("ActiveX failed, blah blah, additional info:\n" + e.description);
}

Upvotes: 3

Gup3rSuR4c
Gup3rSuR4c

Reputation: 9490

As per @Darth, this should be in SO, but I'm going to guess you won't be able to detect if a user is in administrator mode. Having the browser announce such information is just asking for so much trouble you'll want to rip your hair out.

Example, bad site asks users to run in admin mode, users are stupid and do it, user gets viruses/spam/crap/hacks/etc.

Upvotes: 2

Related Questions