各位精英们,大家好,最近遇到一个问题,就是在进入网页时,如果用户没有安装我们的ActiveX控件,我们会提示用户要安装,现在的情况是,等他安装完毕之后,自己要手动刷新页面才能再次使用此页面。我现在要做的是让他装完之后自动刷新页面,大家有什么办法没有?
var GB_DONES=false;
var getCount=0;
var isExists="";
$().ready(function(){
CheckControl();
return true;
});
function CheckControl()
{
if(DetectPlugin())
{
if(getCount>0)
{
clearInterval(isExists);
$("#GB_frame_control").hide();
$("#GB_overlay_control").hide();
$("#GB_window_control").hide();
}
}
else
{
if(getCount==0)
{
GB_HEIGHT= 400;GB_WIDTH= 600;var Sys={};var ua=navigator.userAgent.toLowerCase();
if (window.ActiveXObject)Sys.ie=ua.match(/msie ([\d.]+)/)[1]
if(!GB_DONES) {
$(document.body)
.append("<div id='GB_overlay_control' style='height:1000px;'></div><div id='GB_window_control'><div style='font-size:14px;color:black'><b>安装控件</b></div><div id='GB_caption_control'></div>"
+ "<div id='GB_Config_control'>"
+ " </div>");
if(Sys.ie==6.0)$(window).resize(GB_position_IESix);
if(Sys.ie==7.0)$(window).resize(GB_position_IESeven);
if(Sys.ie==8.0)$(window).resize(GB_position_IESeven);
if(navigator.userAgent.toLowerCase().indexOf("firefox") != -1)$(window).resize(GB_position_IESeven);
GB_DONES=true;
}
$("#GB_frame_control").remove();
$("#GB_window_control").append("<iframe id='GB_frame_control' src='InstallControl.htm'></iframe>");
$("#GB_overlay_control").show();
if(Sys.ie==6.0)GB_position_IESix();
if(Sys.ie==7.0)GB_position_IESeven();
if(Sys.ie==8.0)GB_position_IESeven();
if(navigator.userAgent.toLowerCase().indexOf("firefox") != -1)GB_position_IESeven();
//循环调用检测方法
isExists=setInterval(CheckControl,1000);
}
getCount++;
}
}
//检测的方法(通过向页面中插入object标签,如果成功则ActiveX控件已经安装,否则未安装)
function DetectPlugin(){
var pluginDiv = "";
pluginDiv=document.createElement("<div id=\"pluginDiv\" style=\"display:none\"></div>");
document.body.insertBefore(pluginDiv);
pluginDiv.innerHTML = '<object id="objectForDetectPlugin" classid="CLSID:E77E049B-23FC-4DB8-B756-60529A35FAD5"></object>';
try{
if(eval("objectForDetectPlugin.PrintDoc(1)") == undefined){
pluginDiv.removeNode(true);
return false;
}
else{
pluginDiv.removeNode(true);
return true;
}
}
catch(e){
return false;
}
}