#Failed to read the ‘localStorage’.... Access is denied for this document

5 messages · Page 1 of 1 (latest)

livid robin
#

As part of my application, I'm using WebContentViews to load an external website into my application.

At some point, I need to access the localStorage, and as there's no official solution, the only option is to use executeJavascript, but I'm having a problem because one of my users is getting the following error when executing the following code.

const session = await view.webContents.executeJavaScript( localStorage.getItem('session'); )

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

From what I've seen, it looks like there's a problem with chrome's third-party cookies, but I don't see the link with electron's chromium engine, so there shouldn't be any configuration sharing.

If you have any solutions, I'd love to hear them.

If you also have solutions to simulate the problem I'm also interested.

Thanks in advance

livid robin
#

Up