tags:

views:

26

answers:

1

I have an activex plugin here: http://reboltutorial.com/plugins/logo-badge/

I tried by adapting the script http://forums.devarticles.com/javascript-development-22/detecting-activex-objects-installed-in-ie-11041.html to

<script>
//if RPluginIE is not installed
if( !document.RPluginIE){
document.location.href = "Notfound.html"
}
</script>

but it doesn't work.

How to detect for any activex ?

+1  A: 

First of all, use a proper method for testing

// read more on http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
function isHostMethod(object, property){
    var t = typeof object[property];
    return t == 'function' ||
        (!!(t == 'object' && object[property])) ||
        t == 'unknown';
}

Then your code would look like

if(!isHostMethod(window", "RPluginIE"){
     document.location.href = "Notfound.html";
}

Note that its the window we check, not the document.

Sean Kinsey
Really great article, I couldn't find it while searching google, thanks.
Rebol Tutorial