Fix #8 user agent issue

The user agent needs to be set for the `<webview>` instead of for the `mainWindow`
This commit is contained in:
Jia Hao 2016-01-19 18:06:20 +08:00
parent 8ad805d820
commit 5adf7b9297
2 changed files with 5 additions and 1 deletions

View File

@ -16,6 +16,10 @@ ipc.on('params', function(event, message) {
webView.setAttribute('minwidth', '100');
webView.setAttribute('minheight', '100');
webView.addEventListener('did-start-loading', function() {
webView.setUserAgent(appArgs.userAgent);
});
webView.addEventListener('new-window', function(e) {
require('shell').openExternal(e.url);
});

View File

@ -39,7 +39,7 @@ app.on('ready', function() {
mainWindow.openDevTools();
}
mainWindow.loadUrl('file://' + __dirname + '/index.html', { userAgent: appArgs.userAgent});
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.webContents.on('did-finish-load', function() {
mainWindow.webContents.send('params', JSON.stringify(appArgs));