判断用户浏览器类型的代码
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);
}
}
{
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);
}
}
相关文章推荐
- 判断用户类型代码实现
- 判断浏览器类型屏幕分辨率自动调用不同CSS的代码
- JavaScript 页面编码与浏览器类型判断代码
- JavaScript 页面编码与浏览器类型判断代码
- JS代码判断浏览器类型以及版本
- js判断用户浏览器类型(IE或IE内核和非IE)及判断IE浏览器版本(32位或64位)
- 一段判断多种浏览器类型及版本号的脚本代码
- JS判断浏览器类型与版本的实现代码
- PHP如何判断用户浏览器类型与语言
- js判断浏览器类型,版本的代码(附多个实例代码)
- js小脚本——判断小弹窗和用户浏览器类型
- 自动判断浏览器类型并读取相应CSS的代码
- javascript判断用户浏览器插件安装情况的代码
- PHP如何判断用户浏览器类型与语言
- php判断用户浏览器类型是否为微信浏览器
- 使用php判断浏览器的类型和语言的函数代码
- 自动判断浏览器类型并读取相应CSS的代码
- jquery判断浏览器类型的代码