在要加载的地址后没跟上userAgent对象即可修改
function createWindow () {
win = new BrowserWindow({width: 800, height: 600});
newWin.loadURL(winURL + '#/qinbaobao', {userAgent: args[0].userAgent})
win.on('closed', () => {
win = null
});
}
隔离cookie,每个子窗口的cookie互不干扰
const newWin = new BrowserWindow({
width:900,
height:620,
minWidth:900,
minHeight:620,
frame:true,
fullscreen:false,
title:"项目名",
autoHideMenuBar:true,
webPreferences: {
nodeIntegration: true,
partition: 'fjhkdlsjflkdsjflktret',
contextIsolation: false
}
})
在webPreferences中添加partition属性,并且partition的值为一个字符串,保持每创建一个子窗口partition的值都不相同就行了