Window.open not working


#1

I am building cross platform app on electron for my project. I have one js file in which i want to open a link which i am getting it from server and opening in new tab using window.open. Now on electron initial all tasks are getting performed on electron only the window.open function is opening a new tab in default browser not opening new window in electron itself. Here is my main.js of electron for single click open in new window.

This is main.js from electron for single click new window:
function(module, exports, webpack_require) {

‘use strict’;

Object.defineProperty(exports, “__esModule”, {
value: true
});

var _electron = webpack_require(14);

function initContextMenu(mainWindow) {
_electron.ipcMain.on(‘contextMenuOpened’, function (event, targetHref) {
var contextMenuTemplate = [{
label: ‘Open in new window’,
click: function click() {
if (targetHref) {
new _electron.BrowserWindow().loadURL(targetHref);
return;
}

            mainWindow.useDefaultWindowBehaviour = true;
            mainWindow.webContents.send('contextMenuClosed');
        }
    }];

    var contextMenu = _electron.Menu.buildFromTemplate(contextMenuTemplate);
    contextMenu.popup(mainWindow);
    mainWindow.contextMenuOpen = true;
});

}

exports.default = initContextMenu;

and controller.js from where i am using window.open
var popup;
popup = window.open($scope.machineURL, ‘_blank’);
popup.focus();