asp下通过HTTP_USER_AGENT判断用户是从手机上访问,还是电脑IE上访问

发布时间:2022-04-17 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了asp下通过HTTP_USER_AGENT判断用户是从手机上访问,还是电脑IE上访问脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
通过HTTP_USER_AGENT判断用户是从手机上访问,还是脑IE上访问。

asp代码片段:主要使用了正则匹配手机环境,大家可以补充手机平台。
复制代码 代码如下:

set regex = new regexp
regex.ignorecase = true
regex.global = true
regex.pattern = "mini 9.5|vX1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sPRint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|noVARra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile|IPOd|iphone|andROId|oPEra mini|blackberry|palm os|palm|hiptop|avantgo|fennec|plucker|xiino|blazer|elaine|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile"

agent = request.ServerVariables("HTTP_USER_AGENT") & ""
if agent <> "" then
if not regex.test(agent) then
'不是从手机来的访问,跳转到your.domain.COM
response.redirect("http://your.domain.com")
end if
end if

感谢老曹提供的asp代码。
Dragonchen82@hotmail.com

脚本宝典总结

以上是脚本宝典为你收集整理的asp下通过HTTP_USER_AGENT判断用户是从手机上访问,还是电脑IE上访问全部内容,希望文章能够帮你解决asp下通过HTTP_USER_AGENT判断用户是从手机上访问,还是电脑IE上访问所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。