In order to block LocalStorage access or SessionStorage, developers need to inject some Javascript like like: ``` var localStorage = Object.getOwnPropertyDescriptor(window, 'localStorage'); if (localStorage) { Object.defineProperty(window, 'localStorage', { get: function() { console.error("Local Storage Blocked") return null; }, }); } var sessionStorage = Object.getOwnPropertyDescriptor(window, 'sessionStorage'); if (sessionStorage) { Object.defineProperty(window, 'sessionStorage', { get: function() { console.error("Session Storage Blocked") return null; }, }); } ``` There should be a simpler way to deny a website or anything access to the storage. Currently, there is none.
Thank you for the report! The title says "... doesn't work 100% of the time", can you elaborate on that?
<rdar://problem/59350812>
If you add the cited script as WKUserScript using a WKUserContentController, it should be guaranteed to run before the page does anything. Using `evaluateJavaScript:` and friends instead would race with page loading. Is there any other way in which the JS solution is not adequate?