Let your WAP site have better compatibility

Source: Internet
Author: User
Tags php code
Today to see a friend of the WAP site home page with IE and WAP mobile phone can browse
It looks like he must have done a check on the browser, redirect if it doesn't support WML.

After a moment's thought, redirect is only doing things for browsers that do not support WML (IE)
So Response.Redirect can still be used, the key is how to determine whether the browser support

And then with a friend to see the code, the result is this:

if (Strpos ("WAP", $_http_get_vars[' http_accept ')) {header ("location:http://hikey.net");}

PHP code ...

But my program is ASP ah, and then there is this piece of code:

<%
Response.Buffer = TRUE
Dim Iswap
Httpaccept = LCase (Request.ServerVariables ("http_accept"))
If Instr (httpaccept, "WAP") Then
Iswap=1
Else
Response.Redirect "Http://www.gelon.net/cgi-bin/wapalize.cgi?url=http://hikey.net/wap"
Response.End
End If
%>

Add this code to your WAP page (top!). ): If the browser does not support it, redirect it to the WAP simulator provided by Gelon.net, and the url= can be changed to your website address.

Even if someone else only know your Web site, do not know how to access your site, he can also see the effect ...





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.