ASP to judge the client browser language automatic jump

Source: Internet
Author: User
Tags servervariables

<%
Dim lan
Lan=request.servervariables ("Http_accept_language")

Select Case 1

Case InStr (LAN, "ZH-CN")
Response.Redirect ("http://www.3lian.com//cn/index.asp tutorial")
' Judge whether the client is Chinese simplified, if it is turned to/cn/index.asp

Case InStr (LAN, "ZH-TW")
Response.Redirect ("http://www.3lian.com//tw/index.asp")
' Judge whether the client is Chinese traditional, if it is to turn to/tw/index.asp

Case InStr (LAN, "en")
Response.Redirect ("http://www.3lian.com//en/index.asp")
' Judge whether the client is English if it is turned to/en/index.asp

Case InStr (LAN, "FR")
Response.Redirect ("http://www.3lian.com//fr/index.asp")
' Judge whether the client is French, if it is turned to/fr/index.asp

Case InStr (LAN, "de")
Response.Redirect ("http://www.3lian.com//de/index.asp")
' Judge whether the client is German, if it is turned to/fr/index.asp

End Select

%>

Of course, if only Chinese and English pages, then you can also use the IF function to judge.

<%
Dim lan
Lan=request.servervariables ("Http_accept_language")

If InStr (LAN, "en") >0 then
Response.Redirect ("http://www.3lian.com/")
' if it is Chinese then turn to Chinese page
Else
Response.Redirect ("http://www.3lian.com/")
' if not Chinese, then unify to English page
End If
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.