How do I allow my local web page access to LocalStorage in Brave Browser?
Asked Answered
C

2

8

By default, Brave is blocking all 3rd party cookies, which is fine, however, I want to work on a local project which uses LocalStorage but I get the following error.

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

I don't want to turn 3rd party cookie blocking off, which does circumvent the problem, but I'd rather just whitelist local file access (doesn't allow whitelisting file:// protocol).

Is it even possible to get this working without turning off the global "block all 3rd party cookies" setting?

Convoy answered 10/4, 2019 at 20:16 Comment(0)
S
5

There is 2 ways you can achieve this. Probably also depends how you run your project. I use VS Code and when I run my projects in Brave I got that error. My files were just in a dev directory not in the wwwroot directory.

  1. First option (recommended in my opinion)

    • Go to: Setting->Additional Settings->Privacy and Security->Site Settings->Cookies
    • In the "Allow" section add: "localhost" and "127.0.0.1" Preferred option
  2. Second option (not recommended, as you also stated you don't want to do this)

    • Go to: Settings->Shields->Cookie Control
    • Select "Allow all cookies" Not recommended option

Hope this helps

Sarraute answered 4/7, 2019 at 16:42 Comment(2)
Thank you. I actually figured I had to whitelist in the Cookies settings but I guess I needed to leave out the port, as I had "127.0.0.1:8080".Convoy
Whitelisting localhost and 127.0.0.1 is not working for me in current version of Brave (1.4.96). Switching cookie control shield to Allow all cookies does work. Same goes for Chrome (80.0.3987.132) if Block third-party cookies is on. Annoying since most browsers are likely to turn off third-party cookies by default in future.Bound
M
3

You can whitelist file:///* in brave://settings/content/cookies

Sadly it doesn't seem possible to make this rule more specific to only allow some local web pages access to cookies. And even worse, all local web pages share cookies with each other.

But for testing purposes it should be fine.

Obviously it would make more sense to setup a local web server though.

Mccrae answered 23/5, 2020 at 13:37 Comment(1)
This was what I was searching since I'm checking for local file system. The clue was the "*" ! :) thanks!Soong

© 2022 - 2024 — McMap. All rights reserved.