ie版本过低提示升级ie的示例

本文介绍了一种在网站中检测并提示用户升级IE6及以下版本浏览器的方法,并提供了具体的实现代码。通过检测客户端浏览器版本,当检测到IE6及其以下版本时,会提示用户进行浏览器升级,并禁用后台登录接口。

消灭IE6!

在客户端的ie版本低于等于ie6的情况下,提示用户升级客户端,并将后台登入接口的链接不可用.

 

Index.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="DTLEntAdministration.Web.Index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>驱动人生企业版</title>
    <link href="css/css.css" rel="stylesheet" type="text/css" />
    <style type="text/css">   
        #ie6-warning{background:#FF0; position:absolute;top:0; left:0;font-size:12px; line-height:24px; color:#F00; padding:0 10px;}  
        #ie6-warning img{float:right; cursor:pointer; margin-top:4px;} 
        #ie6-warning a{text-decoration:none;}  
    </style>
</head>

<body>

<div class="xmian">
<asp:HyperLink ID="hlDownload" runat="server" Target="_blank" CssClass="anniu"><img alt="" src="images/x_ico.jpg" width="142" height="52" /></asp:HyperLink>
<a id="loadadmin" href="#" target="_self" class="dl">登录后台管理</a>
<script type="text/javascript">
    var togo = 1;
</script>
<!--[if lte IE 6]>   
<div id="ie6-warning">
<img src="images/cha.jpg" width="14" height="14" onclick="closeme();" alt="关闭提示" />
您正在使用 Internet Explorer 6 低版本的IE浏览器。为更好的浏览本页,建议您将浏览器升级到 
<a href="http://www.microsoft.com/china/windows/internet-explorer/ie8howto.aspx" target="_blank">IE8</a>  
或以下浏览器:<a href="http://www.firefox.com.cn/download/">Firefox</a>
 / <a href="http://www.google.cn/chrome"> Chrome</a>
 / <a href="http://www.apple.com.cn/safari/">Safari</a> / <a href="http://www.Opera.com/">Opera</a>   </div>
<script type="text/javascript">  
    togo = 0; 
    function closeme(){    
        var div = document.getElementById("ie6-warning");    
        div.style.display ="none";
    };
    function position_fixed(el, eltop, elleft){
        // check if this is IE6
        if(!window.XMLHttpRequest)
            window.onscroll = function(){
                el.style.top = (document.documentElement.scrollTop + eltop)+"px";
                el.style.left = (document.documentElement.scrollLeft + elleft)+"px";
            }
        else 
            el.style.position = "fixed";
    };
    position_fixed(document.getElementById("ie6-warning"),0, 0);
</script>   
<![endif]-->
<script type="text/javascript">
    if (togo === 1) document.getElementById("loadadmin").href = 'Home.aspx';  
</script>

</div>

</body>
</html>

 

在ie6及以下版本显示效果如下:

 

在ie6以上的版本或者其他非ie内核的浏览器下则显示如下:

同时登录后台管理的链接可用.

转载于:https://www.cnblogs.com/lucienbao/archive/2012/07/02/ie6_version_update.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值