- public static bool CheckAgent()
- {
- bool flag = false;
-
- string agent = HttpContext.Current.Request.UserAgent;
- string[] keywords = { "Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser" };
-
-
- if (!agent.Contains("Windows NT") || (agent.Contains("Windows NT") && agent.Contains("compatible; MSIE 9.0;")))
- {
-
- if (!agent.Contains("Windows NT") && !agent.Contains("Macintosh"))
- {
- foreach (string item in keywords)
- {
- if (agent.Contains(item))
- {
- flag = true;
- break;
- }
- }
- }
- }
-
- return flag;
- }
function getPlatform()
{//设置平台信息
var platform = -1;
var agent = navigator.userAgent.toLowerCase();
if((/android/gi).test(agent))
{
platform = 1;
}
else if((/iphone/gi).test(agent))
{
platform = 2;
}
else
{
platform = 1;
}
return platform;
}