您的位置:首页 > 编程语言

判断用户浏览器类型的代码

2007-11-15 14:33 405 查看
public string IESupport()

{

string IEType = getBrower();

ArrayList _list = new ArrayList();

string SupportedFlashError_message = "";

using (DBManage _db = new DBManage())

{

string strsql = "select SupportedFlashYesNo,SupportedFlashError_message from supported_flash where SupportedFlashID like '%" + IEType + "%'";

if (_db.SetData(strsql, ref _list))

{

if (_list.Count > 0)

{

string SupportedFlashYesNo = _list[0].ToString();

SupportedFlashError_message = _list[1].ToString();

if (SupportedFlashYesNo == "Yes")

{

}

else

{

//Response.Write("<script>alert('" + SupportedFlashError_message + "')</script>");

return SupportedFlashError_message;

}

}

}

}

return SupportedFlashError_message;

}

public static string getBrower()

{

HttpBrowserCapabilities bc = new HttpBrowserCapabilities();

bc = HttpContext.Current.Request.Browser;

return bc.Type;

}

然后在前台的Body部分的Onload事件中添加js函数:

function CheckMsg()

{

var a = "<%=IESupport()%>";

if(a=="")

{

}

else

{

   alert(a);

   }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: