Javascript SecurityError: Failed to read the’localStorage’ property from’Window’: Access is denied for this document.

When using chrome incognito mode, third-party cookies are blocked by default 

If local storage or cookie is used, an error will be reported in js

Error SecurityError: Failed to read the ‘localStorage ‘ property from ‘Window’: Access is denied for this document.

Failed to read the the’localStorage’ property from windows: Access is denied for this document.

 

This problem can only be handled at the code level to be compatible, and no errors will be reported first.

            if (navigator.cookieEnabled&& typeof window.localStorage !== ' undefined ' ) {
      
            }

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *