Saving information locally on the user’s computer is a powerful technique for a developer who’s going to be creating something for the Web. In this article, we’ll have a look at how easy it is to store home elevators a computer to read later along with explain what you need to use that pertaining to.
Local storage is part of the HTML5 Web Storage API and it allows you to store data in the browser. Unlike cookies, data stored using local storage isn’t sent back to the server. All data stays on the client, and you can currently store from 2MB to 10MB. This limit is tied to the specific browser, protocol (HTTP or HTTPS), port, and top level domain in use.
Table of Contents
Check If Browser Support Local Storage:
<script type="text/javascript> if(window.localStorage){ alert("Your Browser Support Local Storage."); //Local Storage Supported } else { alert("Your Browser Doesn't Support Local Storage."); //Local Storage Is Not Supported } </script>
Remove A Single Row:
<script type="text/javascript> localStorage.removeItem(key); //Remove A Single Desired KEY From Local Storage </script>
Insert A Single Row:
<script type="text/javascript> localStorage.setItem("key", "value"); //Set A Single Desired KEY-VALUE In Local Storage </script>
Get A Single Row:
<script type="text/javascript> var getValue = localStorage.getItem("key"); //Get A Single Desired KEY's VALUE From Local Storage </script>
Remove All Rows:
<script type="text/javascript> localStorage.clear(); //Clear All Local Storage KEY-VALUE </script>
Customization:
You just have to chnage your key
and save your desired data at value
. Rest all is ok.
Last Words:
That’s all we have. If you have any problem with this code in your template then feel free to contact us with full explanation of your problem. We will reply you as time allow to us. Don’t forget to share this with your friends so they can also take benefit from it and leave your precious feedback in our comment form below. Happy blogging, See you in next article…
Be the first to write a comment.