Using Localstorage and JS template engine to develop M station idea

Source: Internet
Author: User

The current mode of M-station development, still request the full HTML, so that the problem is the amount of data per request too much, in the absence of WiFi, resulting in a slow page opening, the consumption of traffic is more; Access M station is mobile device, its browser version is higher, So its HTML5 attribute Localstorage support is also good, and the M station page is relatively simple, the structure is better, if the use of Localstorage+js analytic template +json data way to achieve m structures, its access speed should be greatly improved.

The specific implementation is as follows:

1. The HTML node of the page is stored in the Localstorage, because the M station structure is simple, the main points of the page is basically home/Channel page/category page/Search results page/Product Details page/booking page, and the page itself is relatively simple, so the overall data volume will not be large

2. When the page is accessed, the background pushes the JSON data, and then uses the JS Template parsing tool to assemble the JSON with the data in the Localstorage and populate it in the page

If implemented in this way, when the page is accessed, the amount of data returned is very small, with only one JSON object.

Pros: Small amount of data returned, page open speed block

Cons: not conducive to page SEO

Using Localstorage and JS template engine to develop M station idea

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.