Application Scenarios:
When we use JSON to simulate the background data, the foreground and delete changes are put data into a JavaScript object, but this method of data can only work on a page. The advent of localstorage solved our problem! That is, the data is stored in the browser via Localstorage, and then the localstorage is removed from another page to reference this data! For example, when you first visit a page, expand the Main Menu submenu in the page, refresh the page, the submenu has been automatically expanded (because the status has been recorded in the browser), or close the browser to reopen the page, the submenu is still expanded.
code: Now there is a JSON file, click on the "Get Data" button, the contents of the JSON file read to the page. Click the button again to clear the contents. JSON file HTML code when the button is clicked, the contents of the JSON file are shown in the DIV with the ID jsontip, with Data-rel to mark the status. JS Code click the button to refresh the page
HTML5 Localstorage Browser Local Storage