我在我的 Electron 桌面应用程序中使用 Facebook 身份验证。我正在将 FB auth View 加载到 Electron BrowserWindow 中。当 BrowserWindow 首次加载时,我收到错误消息:
Uncaught DOMException: Failed to set the 'cookie' property on 'Document': Cookies are disabled inside 'data:' URLs.
当我尝试登录时,我收到错误:
Uncaught DOMException: Failed to read the 'cookie' property from 'Document': Cookies are disabled inside 'data:' URLs.
这是我将 Facebook View (data['_body']) 的原始 HTML 加载到 BrowserWindow 中的方式:
let windowProperties = {
height: 900,
width: 1200,
webPreferences: {
webSecurity: false,
nodeIntegration: false
}
};
let win = new electron.remote.BrowserWindow(windowProperties)
win.loadURL('data:text/html,' + encodeURIComponent(data["_body"]));
任何帮助将非常感激!
最佳答案
您可能正在寻找 browserWindow.webContents.Session .如果您正在使用旧版本的 Electron ,您可以查看 Electron-cookies .
关于facebook - Electron BrowserWindow Facebook 登录设置 Cookie 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44973467/