Describe the bug
Everything works just fine in development mode but I'm getting this error in the devtools console after building my app:
Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
at app://./js/chunk-vendors.0b3afa94.js:175:17895
at Object.b25c (app://./js/chunk-vendors.0b3afa94.js:175:18055)
at l (app://./js/app.a7acfa50.js:1:618)
at Module.56d7 (app://./js/app.a7acfa50.js:1:7568)
at l (app://./js/app.a7acfa50.js:1:618)
at Object.0 (app://./js/app.a7acfa50.js:1:3170)
at l (app://./js/app.a7acfa50.js:1:618)
at n (app://./js/app.a7acfa50.js:1:388)
at app://./js/app.a7acfa50.js:1:3135
at app://./js/app.a7acfa50.js:1:3140
To Reproduce
npm run electron:build
and then open the the app
Expected behavior
Get access to LocalStorage
Environment (please complete the following information):
module.exports = {
pluginOptions: {
electronBuilder: {
// List native deps here if they don't work
externals: ['serialport', 'osc'],
nodeModulesPath: ['./node_modules']
}
}
}
Additional context
This only started after I changed to electron 5.0.0 and node 12.0.0.
Later, to correct another problem, namely an "error 138" while trying to build the app I updated it to 12.1.0.
Thank you for this project. Since now I'm having a solid experience with it.
best regards,
Gil
@gilfuser I have the same problem, how did you solved this..
Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
at app://./static/tinymce4.7.5/tinymce.min.js:2:334766
at app://./static/tinymce4.7.5/tinymce.min.js:2:337378
index.html:1 Uncaught DOMException: Failed to read the 'cookie' property from 'Document': Access is denied for this document.
at Function.i [as set] (app://./js/chunk-vendors.8d12f151.js:70:1078)
at Function.i.get (app://./js/chunk-vendors.8d12f151.js:70:1494)
at v (app://./js/app.58b4478d.js:1:68573)
at Object.9923 (app://./js/app.58b4478d.js:1:68773)
at r (app://./js/app.58b4478d.js:1:2352)
at Module.d9cd (app://./js/app.58b4478d.js:1:122194)
at r (app://./js/app.58b4478d.js:1:2352)
at i (app://./js/app.58b4478d.js:1:120363)
at app://./js/app.58b4478d.js:1:29578
at Array.reduce (<anonymous>)
background.js use standard: true,
protocol.registerSchemesAsPrivileged([
{ scheme: 'app', privileges: { standard: true, supportFetchAPI: true, secure: true } }
])
@crossle think you
@crossle

How should this cross-domain problem be handled?
the server is php
try corsEnabled: true
see https://github.com/electron/electron/blob/master/docs/api/structures/custom-scheme.md
@crossle i have set the corsEnabled:true, but the problem still exists
Try set BrowserWindow websecurity false
webSecurity Boolean (optional) - When false, it will disable the same-origin policy (usually using testing websites by people), and set allowRunningInsecureContent to true if this options has not been set by user. Default is true.
@crossle think you
These was caused by the app:// scheme not being registered as standard. This is fixed as of version 1.3.2. If you were previously using an older version, you must manually update your background.js:
// Replace
protocol.registerSchemesAsPrivileged([{scheme: 'app', privileges: { secure: true } }])
// With
protocol.registerSchemesAsPrivileged([{scheme: 'app', privileges: { secure: true, standard: true } }])
Many thanks!
On Thu, May 9, 2019, 12:25 AM Noah Klayman notifications@github.com wrote:
These was caused by the app:// scheme not being registered as standard.
This is fixed as of version 1.3.2. If you were previously using an older
version, you must manually update your background.js:// Replaceprotocol.registerSchemesAsPrivileged([{scheme: 'app', privileges: { secure: true } }])// Withprotocol.registerSchemesAsPrivileged([{scheme: 'app', privileges: { secure: true, standard: true } }])
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/262#issuecomment-490729000,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACHYAKVYT7ZCLSK2NWQOVL3PUOKTRANCNFSM4HKYM3OA
.
Most helpful comment
background.js use
standard: true,