October 9, 2016
October 1, 2016
JavaScript localstorage with good example
In javascript using localstorage you can simply save any single OR array value same like work as a PHP session.
There is a simple solution though, and that’s to use local
storage.
The
good news is to stored any data to computer so when page reload then you can
get data back from localstorage.
WHAT IS EXACT MEANING OF LOCAL STORAGE?
- Local Storage: stores data with no expiration date and this is the one we will be using because we want our to-do’s to stay on the page for as long as possible.
- Session Storage: only saves the data for one session so if the user closes the tab and reopens it all their data will be gone.
BELOW ARE SOME EXAMPLE FOR SET VALUE, GET VALUE AND CLEAR VALUE FROM LOCAL STORAGE
To set item into local storage:
localStorage.setItem('username', 'admin');
To get value from local storage:
localStorage.getItem
('username');
Output: admin
To clear any value from local storage:
localStorage.removeItem
('username');
Enjoy!
Subscribe to:
Posts (Atom)
The Future of Technology: Emerging Trends to Watch in 2025
Introduction As we navigate through 2025, the technological landscape continues to evolve at an unprecedented pace. Innovations that once se...

-
Put this code between <head>...</head> tag. <script type="text/javascript"> function readURL(input) { ...
-
$no = 5; $no2 = 10; $no3 = 6; $maxVal = max($no,$no2,$no3); echo $maxVal; Result: 10
-
If you want to change page title from admin side then please follow below steps: * Login in admin and open CMS > Static pages, th...