You want to persist data on the client only until the current session is ended, i.e., the window or tab is closed.
In this example there are two HTML pages. Each page contains a set of selectable elements. When elements are selected and deselected, the state of the page is persisted. By navigating to and from the two pages, you can see how the state of any given page can be maintained as a user navigates through a website. The sessionStorage object is used for data that doesn’t require persisting between a user’s subsequent visits:
When the document is loaded, the session Storage object is queried for keys comprising the current URL and the id of each of the selectable squares. Each square has a CSS class applied if appropriate. When a square is clicked, its display is affected by toggling a CSS class, and its state is persisted accordingly. Each square’s state is persisted using a key generated from the current URL and current element id pair.
Similar session-delimited client-side storage is available when using the jStore plugin from the previous recipe. By using jStore, you gain the benefits of cross-browser compatibility. This recipe will only work in Internet Explorer 8.0 and Firefox 2.0 or higher. Safari 3.1 doesn’t have this feature, though future versions are slated to include it.
J Query Related Interview Questions
|HTML 4 Interview Questions||HTML Interview Questions|
|HTML 5 Interview Questions||Zend Interview Questions|
|JqueryUI Interview Questions||Dynamic HTML Interview Questions|
|XQuery Interview Questions||jQuery Mobile Interview Questions|
J Query Related Practice Tests
|HTML 4 Practice Tests||HTML Practice Tests|
|HTML 5 Practice Tests||Zend Practice Tests|
|PHP and Jquery Practice Tests||J Query Practice Tests|
|CodeIgniter Practice Tests||Dynamic HTML Practice Tests|
J Query Tutorial
Selecting Elements With Jquery
Beyond The Basics
Faster, Simpler, More Fun
Html Form Enhancements From Scratch
Html Form Enhancements With Plugins
Interface Components From Scratch
User Interfaces With Jquery Ui
Jquery Ui Theming
Jquery, Ajax, Data Formats: Html, Xml, Json, Jsonp
Using Jquery In Large Projects
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.