Skip to content

Instantly share code, notes, and snippets.

@SuddenDevelopment
Created June 7, 2017 13:57
Show Gist options
  • Save SuddenDevelopment/e58b81e7222d7fc6be86bc9011858d03 to your computer and use it in GitHub Desktop.
Save SuddenDevelopment/e58b81e7222d7fc6be86bc9011858d03 to your computer and use it in GitHub Desktop.
electron new window from ipc
// get an IPC message from renderer
// I put an "action" filed in my ipc messages to switch on
ipcMain.on('electron-msg', (event, objMsg) => {
//handle incoming message here
switch(objMsg.action){
case 'oAuth':
// Create a system default browser window.
shell.openExternal(objMsg.data.url);
// OR navigate the current electron window to the new url
mainWindow.loadURL(objMsg.data.url);
// OR open a new electron window that can be referenced
var oAuthWindow = new BrowserWindow({ width: 480, height: 700, });
var strUrl=objMsg.data.url;
oAuthWindow.loadURL(strUrl);
break;
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment