2

i have just discovered about electron js. i want to create desktop app which can help to open website with proxy server. i have tried following code, please help me.and please comment any working example.

const electron = require('electron');
const app = electron.app;
var BrowserWindow = require('browser-window');

electron.crashReporter.start();

var mainWindow = null;

app.on('window-all-closed', function() {
    if (process.platform != 'darwin') {
        app.quit();
    }
});

app.on('ready', function() {

    // without proxy simple
    //var win = new BrowserWindow({ width: 800, height: 600, show: false });
    //win.on('closed', function() {
    //    win = null;
    //});
    //
    //win.loadURL('https://www.panduboys.com');
    //win.show();

    var win = new BrowserWindow({ width: 800, height: 600 });
    win.loadUrl("http://www.panduboys.com");

    var session = win.webContents.session
    session.setProxy("http=190.98.162.22:8080", function() {
        console.log('done proxy kind of things');
    });
});
Vinay Pandya
  • 3,020
  • 2
  • 26
  • 42

0 Answers0