欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

window.close() 避免弹框提示关闭

程序员文章站 2022-07-13 10:29:35
...
function Close(){
	var ua = navigator.userAgent;
	var ie = navigator.appName == "Microsoft Internet Explorer"?true:false;
	if(ie){
		var IEversion = parseFloat(ua.substring(ua.indexOf("MSIE")+5,ua.indexOf(";",ua.indexOf("MSIE"))));
		alert(IEversion);
		if(IEversion < 5.5){
			var str = "<object id = 'noTipClose' classid='clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11'>";
			str += "<param name='Command' value='Close'/></object>";
			document.body.insertAdjacentHTML("beforeEnd",str);
			document.all.noTipClose.Click();
		}else{
			window.parent.opener = null;
			window.parent.open('','_self','');
			window.parent.close();
		}
	}else{
		widow.parent.close();
	}
	}
相关标签: close ie