[WebView 6]: Web Apps best practice rules and webview Best Practices

Source: Internet
Author: User

[WebView 6]: Web Apps best practice rules and webview Best Practices

In the previous article, we learned ([WebView 5]: Debugging Web Apps). Today we will continue to learn.

(Blog address: http://blog.csdn.net/developer_jiangqq), reprint please note.

Author: hmjiangqq

Email: jiangqqlmj@163.com

Developing Web pages and Web applications for mobile devices is different from developing traditional desktop Web browsers. To help you better develop and develop more effective Web applications for mobile devices, the following development practices are useful:

(1): Redirect access from mobile devices to Web pages customized for websites

There are several methods to redirect requests to websites of the mobile device version when using server-side redirection. In most cases, we can use the server to "sniff" the user agent information of the Web browser to determine whether to use a mobile version of the website. You can simply query whether the user agent information "mobile" exists. This method is suitable for most mobile devices. If necessary, you can define a special user proxy information (for example, "Android2.1 ").

[Note]: A large Android device must provide a full-size website (for example, a tablet) because the device does not contain user agent information such as "mobile. Other Android devices have similar user agent information. Because the mobile version of the website is determined by the existence of User Agent information such as "mobile" on the device.

(2): the HTML code of a webpage requires the use of the DOCTYPE tag that is suitable for mobile devices.

The most common markup language for mobile website construction is based on XHTML. This standard ensures the best performance on mobile devices. For example, the HTML Frames or nested table structure is not allowed. Once the DOCTYPE label is used, make sure that the webpage code document uses a special character encoding (for example, a UTF-8 ). As follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN"    "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">

At the same time you need to determine that the DOCTYPE statement in the Web tag is valid, you can verify through the following website: http://validator.w3.org.


(3): Correct Use of viewport meta data to debug Web pages for optimal display

In the

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">

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.