mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-11-16 01:37:07 +00:00
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:
parent
8ad805d820
commit
5adf7b9297
@ -16,6 +16,10 @@ ipc.on('params', function(event, message) {
|
|||||||
webView.setAttribute('minwidth', '100');
|
webView.setAttribute('minwidth', '100');
|
||||||
webView.setAttribute('minheight', '100');
|
webView.setAttribute('minheight', '100');
|
||||||
|
|
||||||
|
webView.addEventListener('did-start-loading', function() {
|
||||||
|
webView.setUserAgent(appArgs.userAgent);
|
||||||
|
});
|
||||||
|
|
||||||
webView.addEventListener('new-window', function(e) {
|
webView.addEventListener('new-window', function(e) {
|
||||||
require('shell').openExternal(e.url);
|
require('shell').openExternal(e.url);
|
||||||
});
|
});
|
||||||
|
@ -39,7 +39,7 @@ app.on('ready', function() {
|
|||||||
mainWindow.openDevTools();
|
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.on('did-finish-load', function() {
|
||||||
mainWindow.webContents.send('params', JSON.stringify(appArgs));
|
mainWindow.webContents.send('params', JSON.stringify(appArgs));
|
||||||
|
Loading…
Reference in New Issue
Block a user