我在这里有一个activex插件: http://reboltutorial.com/plugins/logo-badge/
<script>
//if RPluginIE is not installed
if( !document.RPluginIE){
document.location.href = "Notfound.html"
}
</script>
但它不起作用。
如何检测任何activex?
答案 0 :(得分:1)
首先,使用适当的方法进行测试
// 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';
}
然后你的代码看起来像
if(!isHostMethod(window", "RPluginIE"){
document.location.href = "Notfound.html";
}
请注意,我们检查的是窗口,而不是文档。