You can decide whether to show popups once or never when page loads, you can also store the state of selected tabs on accordion and tabs widgets. Your readers will now experience a more interesting interface with endless possibilities. Lets dive into this new method and learn for the first time how to save index states using HTML5 Localstorage method in blogspost blogs.
|HTML Local Storage|
|1. Saves data on your hard disk||1. Saves data on your browser|
|2. Anyone can access the cookie|| |
2. Not everyone can access it. A website can only access data stored by itself
|3. Slow execution||3. Instant execution|
|4. Stores limited amount of Data||4. Stores Large amount of Data|
|5. Not secure||5. More secure|
A web cookie, HTTP cookie or browser cookie, is simply a text file that a Website stores on a user's hard disk to contain information about user activity. Cookies allow a Website to store information on a user's machine and later retrieve it. The information is stored in name and value pairs. Facebook, Google and all major sites show stuff you like because they are tracking your activity using cookies stored on your hard disk.
Here comes my favorite way of controlling events on a webpage. It also does the same work which a cookie does. The only difference is that it stores data on your browser instead of hard disk. Its more secure and much faster. It can store large amount of data without effecting a website's load time. Thus having an edge over a web cookie.
The data is stored in key/value pairs, and a web page can only access data stored by itself. It has two types which are:
1. LocalStorage: stores data with no expiration date
The data will remain in client's browser forever as long as the client doesn't delete browser cache.
To set a LocalStorage cookie just use the function:
To fetch data or access data use:
2. SessionStorage : stores data for one session
Here data will be saved for only one session. Data is lost as soon as the user closes the browser or opens the same website on a new tab.
To set a sessionStorage cookie just use the function:
To access data use:
Test the demo below to get a crystal clear idea.
Show me a Demo!
Take an example of the sticky bar used on MBT. When you click the toggle button, the sticky bar shows or hides. When you don't want this bar to be shown, simply click the toggle button. Now you can visit any page on the blog and the stickybar will remain hidden. But if you close the browser or open mbt in a new tab, you will observe that stickybar shows up again. This happens because the session data expires as soon as you close the browser window or switch to a new tab for same site.
Need Quick Help within 24 Hours? ASK NOW
If you don't want to get yourself into Serious Technical Trouble while editing your Blog Template then just sit back and relax and let us do the Job for you at a fairly reasonable cost. Submit your order details by Clicking Here »