SEO知识

程序自动判断,从电脑跳转到手机的ASP源码

seo优化

我们知道,用js做手机站跳转到电脑站速度会慢,而直接使用服务器语言比较准确而且跳转速度快,除了因为伪静态原因而没有办法做asp或php跳转的情况,我们都是建议用程序来做跳转。

这里是杭州SEO经常用的asp版本手机判断跳转的源代码:

HTTP_ACCEPT=Request.ServerVariables(“HTTP_ACCEPT”) 获取浏览器信息

HTTP_USER_AGENT=LCase(Request.ServerVariables(“HTTP_USER_AGENT”)) 获取AGENT

HTTP_X_WAP_PROFILE=Request.ServerVariables(“HTTP_X_WAP_PROFILE”) WAP特定信息 品牌机自带浏览器都会有

HTTP_UA_OS=Request.ServerVariables(“HTTP_UA_OS”) 手机系统 电脑为空

HTTP_VIA=LCase(Request.ServerVariables(“HTTP_VIA”)) 网关信息

Dim WapStr

WAPstr=False

If ubound(split(HTTP_ACCEPT,“vnd.wap”))>0 Then WAPstr=True

If HTTP_USER_AGENT=“” Then WAPstr=True

If HTTP_X_WAP_PROFILE<>“” Then WAPstr=True

If HTTP_UA_OS<>“” Then WAPstr=True

IF ubound(split(HTTP_VIA,“wap”))>0 Then WAPstr=True

IF ubound(split(HTTP_USER_AGENT,“netfront”))>0 Then WAPstr=True

IF ubound(split(HTTP_USER_AGENT,“iphone”))>0 Then WAPstr=True

IF ubound(split(HTTP_USER_AGENT,“opera mini”))>0 Then WAPstr=True

IF ubound(split(HTTP_USER_AGENT,“ucweb”))>0 Then WAPstr=True

IF ubound(split(HTTP_USER_AGENT,“windows ce”))>0 Then WAPstr=True

IF ubound(split(HTTP_USER_AGENT,“symbianos”))>0 Then WAPstr=True

IF ubound(split(HTTP_USER_AGENT,“java”))>0 Then WAPstr=True

IF ubound(split(HTTP_USER_AGENT,“android”))>0 Then WAPstr=True

If WAPstr=True Then

response.redirect “http://m.390seo.com/”

response.end

End if

本文由 长春SEO优化-网络推广-网站托管外包 作者:青玉seo 发表,转载请注明来源!

seo优化