https://github.com/gkucmierz/test-of-localstorage-limits-quota
Test of localStorage limits/quota using bisection algorithm
https://github.com/gkucmierz/test-of-localstorage-limits-quota
Last synced: about 2 months ago
JSON representation
Test of localStorage limits/quota using bisection algorithm
- Host: GitHub
- URL: https://github.com/gkucmierz/test-of-localstorage-limits-quota
- Owner: gkucmierz
- Created: 2020-05-03T22:35:07.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-10T12:25:12.000Z (almost 4 years ago)
- Last Synced: 2025-03-27T12:02:04.518Z (2 months ago)
- Language: JavaScript
- Homepage: https://gkucmierz.github.io/Test-of-localStorage-limits-quota/
- Size: 7.81 KB
- Stars: 5
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Test-of-localStorage-limits-quota
Test of localStorage limits/quota using bisection algorithmI wrote this simple code that is testing localStorage size in bytes.
```js
const check = words => {
try {
localStorage.clear();
localStorage.setItem('a', '0'.repeat(words));
localStorage.clear();
return true;
} catch(e) {
localStorage.clear();
return false;
}
};
```Github pages:
[https://gkucmierz.github.io/Test-of-localStorage-limits-quota/](https://gkucmierz.github.io/Test-of-localStorage-limits-quota/)
I have the same results on desktop chrome, opera, firefox, brave and mobile chrome which is ~5Mbytes
[![enter image description here][1]][1]
And half smaller result in safari ~2Mbytes
[![enter image description here][2]][2]
[1]: https://i.stack.imgur.com/5RNwe.png
[2]: https://i.stack.imgur.com/rnfZn.png