根据来访者浏览器类型显示不同网页ASP版
这个很简单,就是利用asp内建的ServerVariables集合判断浏览器类型。事实上,不只浏览器类型可以判断,甚至版本也可以,其中ie的版本就比较多,如IE5.01、IE7.0 ...
vb 代码
- <%
- Dim BrowserString
- BrowserString = Request.ServerVariables("HTTP_USER_AGENT")
- BrowserString = Lcase(BrowserString)
- Dim broFirefox,broMSIE,broOpera,broWap
- broFirefox = "firefox"
- broMSIE = "msie"
- broOpera = "opera"
- broWap = "wap"
- '如果是Firefox
- if Instr(BrowserString, broFirefox) <> 0 then
- Response.Redirect(broFirefox & ".asp")
- end if
- '如果是MSIE
- if Instr(BrowserString, broMSIE) <> 0 then
- Response.Redirect(broMSIE & ".asp")
- end if
- '如果是Opera
- if Instr(BrowserString, broOpera) <> 0 then
- Response.Redirect(broOpera & ".asp")
- end if
- '如果是Wap
- if Instr(BrowserString, broWap) <> 0 then
- Response.Redirect(broWap & ".asp")
- end if
- %>