From 53383ebae7cb4d2f88ba25d2d38227c94b1ab35e Mon Sep 17 00:00:00 2001 From: Jia Hao Date: Tue, 19 Jan 2016 18:18:43 +0800 Subject: [PATCH] Only attempt to change user agent if it is provided as an argument --- app/assets/js/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/js/index.js b/app/assets/js/index.js index 29177e2..05e96da 100644 --- a/app/assets/js/index.js +++ b/app/assets/js/index.js @@ -16,9 +16,11 @@ ipc.on('params', function(event, message) { webView.setAttribute('minwidth', '100'); webView.setAttribute('minheight', '100'); - webView.addEventListener('did-start-loading', function() { - webView.setUserAgent(appArgs.userAgent); - }); + if (appArgs.userAgent) { + webView.addEventListener('did-start-loading', function() { + webView.setUserAgent(appArgs.userAgent); + }); + } webView.addEventListener('new-window', function(e) { require('shell').openExternal(e.url);