About mobile-side compatibility issues with Sessionstorage

Source: Internet
Author: User

There are many local storage areas that need to be used when developing mobile projects recently. It's all about just remembering the user data for the current open window, so I chose to use the sessionstorage. The following scenarios are used:

A.html page needs to record a data {a:1,b:2};

sessionStorage.setItem("data","{a:1,b:2}");

B.html page out of use;

sessionStorage.getItem("data"); // 获取结果为null

Question: If the project is not a single page re-application, AB is two HTML files that need to jump to the href. We will find that some of the Andiron system's browsers on page B get the result is null (such as: Vivo mobile phone comes with the window browser of the world).

After analysis, this is not the browser does not support Sessionstorage, because you can still get to sessionstorage this object. But because Sessionstorage is a current window of the data storage format, some browsers in the jump to the new page when his system is open a new WebView, the original off, it is equivalent to our browser opened a new window. In this way he is in conflict with our sessionstorage principle, and in the new page of course it is not available. So it is recommended that you do not use sessionstorage when you do the mobile side of the project if it is not a single page re-application. Use with caution!

About mobile-side compatibility issues with Sessionstorage

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.