pfrazee / electron-browser

browser ui for electron, written in react
227 stars 63 forks source link

Proxy Support #4

Closed myfrndjk closed 7 years ago

myfrndjk commented 7 years ago

Hi,

Can we set proxy dynamically in this browser. Something like

if the url is google.com --> '123.123.123.1':80 if the url is facebook.com --> '222.122.122.2':80

If yes where do i have to set that

pfrazee commented 7 years ago

I think you could probably do that in your /etc/hosts file. Is this something that you can do in Chrome or Firefox? (It'd help if I could see an existing implementation)

myfrndjk commented 7 years ago

Hi,

I tried some thing like below code in some other sample electron browser it is working fine but unfortunately it is not working with your version.I dont know where to modify your code exactly ` const {app, BrowserWindow} = require('electron');

let mainWindow;

app.on('window-all-closed', function() { app.quit(); });

app.on('ready', function() { mainWindow = new BrowserWindow({width: 1024, height: 768 }); var myVar = setInterval(myTimer, 5000);

function myTimer() { mainWindow.webContents.session.setProxy({pacScript:'file://' + dirname + '/proxy.pac'}, function () {}); } mainWindow.loadURL('file://' + dirname + '/browser.html'); mainWindow.openDevTools(); }); `

pfrazee commented 7 years ago

Sorry, I don't have enough free time to offer coding support like this. You'll have to solve this one on your own!

myfrndjk commented 7 years ago

Sure. :)