复制代码 代码如下:
/// <summary>
/// 根据 Agent 判断是否是智能手机
/// </summary>
/// <returns></returns>
public static bool CheckAgent()
{
bool flag = false;
string agent = HttpContext.Current.Request.UserAgent;
string[] keywords = { "Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser" };
//排除Window 桌面系统 和 苹果桌面系统
if (!agent.Contains("Windows NT") && !agent.Contains("Macintosh"))
{
foreach (string item in keywords)
{
if (agent.Contains(item))
{
flag = true;
break;
}
}
}
return flag;
}
新闻热点
疑难解答
图片精选