【问题标题】:Internet Explorer: Disable Access from VisitorsInternet Explorer:禁止访问者访问
【发布时间】:2019-06-17 09:45:02
【问题描述】:

当有人使用 IE 浏览时,有没有办法禁止访问我的网站?最好将他们重定向到一个不错的登录页面,您可以在其中解释为什么无法访问。

我在我的项目中使用 Laravel =)。

干杯, 斯坦

【问题讨论】:

    标签: css html internet-explorer web browser


    【解决方案1】:

    试试

    PHP有函数$_SERVER['HTTP_USER_AGENT']用来识别浏览器

     if(using_ie())
     {
       //redirect
     }
    function using_ie() 
        { 
            $u_agent = $_SERVER['HTTP_USER_AGENT']; 
            $ub = False; 
            if(preg_match('/MSIE/i',$u_agent)) 
            { 
                $ub = True; 
            } 
    
            return $ub; 
        } 
    

    你也可以使用

    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
      header('Location: /index-ie.php');
      exit;
    }
    

    【讨论】: