Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if IE access my site as a trusted site?

Is it possible to determine whether my web site is being accessed as a trusted site? In another question we determined that, in general, it is not prudent to have visibility to client IE settings. Would this qualify as an exception?

The reason I'd like to do this is that some functions won't work unless the site is being accessed as a trusted site (e.g. client-side sendmail -- don't ask), and I'd like to be able to warn users. Despite many warnings in the pages, many users still don't read, and send us nastygrams. We'd like to reduce the email volume by detecting this condition and flashing a big warning that basically says "You didn't read the warnings, and what you're trying to do won't work until you change your settings!" Any ideas are welcome.

EDIT: In our shop, client-side sendmail only works if the site is trusted, and I can't change that due to security requirements, nor can I switch to server-side sendmail. However, this is not the only reason that client-side sendmail will fail, so I can't simply catch a sendmail error to determine this. Also, I don't want this to degrade to a sendmail discussion.

like image 263
Ken Paul Avatar asked Oct 31 '08 19:10

Ken Paul


1 Answers

Here's a test you could use:

function isTrustedIE(){
    try{
        var test=new ActiveXObject("Scripting.FileSystemObject");
    }
    catch(e){
        return false;
    }

    return true;
}

This will, of course, fail if the user has disabled that particular object, even on a trusted site.

like image 183
Joel Anair Avatar answered Sep 24 '22 14:09

Joel Anair