判断浏览器的类别

            Dim isSafari As Boolean = False
            Dim bc As HttpBrowserCapabilities = Request.Browser
            If bc.Type.IndexOf("Apple") > 0 Or bc.Type.IndexOf("Safari") > 0 Or bc.Browser.IndexOf("Apple") > 0 Or bc.Browser.IndexOf("Safari") > 0 Then
                isSafari = True
            End If
            If isSafari Then
                Me.btnGenerateRePort.Attributes.Add("onclick", "this.form.target='_blank'")
            End If

 

       bool isSafari = false;
       bool isFireFox = false;
       HttpBrowserCapabilities hbc = Request.Browser;
       if (hbc.Type.IndexOf("Safari")>=0 || hbc.Type.IndexOf("Apple")>=0
           || hbc.Browser.IndexOf("Safari") >= 0 || hbc.Browser.IndexOf("Apple") >= 0)
       {
           isSafari = true;
       }
       if (hbc.Type.IndexOf("Gecko") >= 0 || hbc.Type.IndexOf("Firefox") >= 0
           || hbc.Browser.IndexOf("Gecko") >= 0 || hbc.Browser.IndexOf("Firefox") >= 0)
       {
           isFireFox = true;
       }

posted @ 2010-10-22 22:07  emanlee  阅读(406)  评论(0编辑  收藏  举报