【转】
[C#] 纯文本查看 复制代码 public bool IsMoblie()
{
string agent = (Request.UserAgent + "").ToLower().Trim();
if (agent == "" ||
agent.IndexOf("mobile") != -1 ||
agent.IndexOf("mobi") != -1 ||
agent.IndexOf("nokia") != -1 ||
agent.IndexOf("samsung") != -1 ||
agent.IndexOf("sonyericsson") != -1 ||
agent.IndexOf("mot") != -1 ||
agent.IndexOf("blackberry") != -1 ||
agent.IndexOf("lg") != -1 ||
agent.IndexOf("htc") != -1 ||
agent.IndexOf("j2me") != -1 ||
agent.IndexOf("ucweb") != -1 ||
agent.IndexOf("opera mini") != -1 ||
agent.IndexOf("mobi") != -1 ||
agent.IndexOf("android") != -1 ||
agent.IndexOf("iphone") != -1)
{
//客户瑞是手机
return true;
}
return false;
}
|