5

When using my webpage (http://localhost/mypage.html) accessing localStorage issues a security error:

Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

It is just a simple line

res = localStorage.getItem(name);

and even

console.log(localStorage); 

issues the same error.

But it is a LOCAL site, so no cross domains are used.

What goes wrong here ?

Josiah Keller
  • 3,635
  • 3
  • 23
  • 35
php and js
  • 867
  • 1
  • 6
  • 13

1 Answers1

0

This problem is related to a Chromium bug which is now fixed. See https://community.brave.com/t/html5-localstorage/100843

You can check if your current version is affected with this JSFiddle : https://jsfiddle.net/6sm54/2/

function lsTest(){ 
    var test = 'test';
    try {
      localStorage.setItem(test, test);
      localStorage.removeItem(test);
      return true;
    } catch(e) {
      return false;
    }
}
Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240