If security is a concern, due to third party scripts having access to localStorage, then you can do something like this to remove third party access to it.
constStorage={provider:window.localStorage,get(key){returnJSON.parse(this.provider.getItem(key))},set(key,value){this.provider.setItem(key,JSON.stringify(value));},remove(key){this.provider.removeItem(key);},};deletewindow.localStorage;Storage.set("test",true);Storage.get("test",true);Storage.remove("test",true);localStorage.getItem("test");// will fail
This makes localStorage private to your Storage wrapper.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If security is a concern, due to third party scripts having access to
localStorage
, then you can do something like this to remove third party access to it.This makes
localStorage
private to yourStorage
wrapper.