diff --git a/background.js b/background.js index 818a5b1..1aeb494 100644 --- a/background.js +++ b/background.js @@ -220,6 +220,11 @@ function launch(launchData) { chrome.storage.local.remove('relativeLaunchUrl', launchApp); } + // If we are relaunching the app, inform the webview so it'll start again. + if(window.app && relativeUrl) { + chrome.runtime.sendMessage({command: "restart"}, (response) => {}); + } + function launchApp() { var info = { type: 'onLaunched', diff --git a/browser.js b/browser.js index 739348b..f388ee1 100644 --- a/browser.js +++ b/browser.js @@ -206,7 +206,10 @@ function handleLoadRedirect(event) { return; } - document.querySelector('#location').value = event.newUrl; + var location = document.querySelector('#location'); + if(location !== null){ + location.value = event.newUrl; + } } function handleNewWindow(event) { @@ -272,7 +275,10 @@ function handleMessage(message, sender, sendResponse) { }); }); return !!sendResponse; // wait for response + } else if (message.command === 'restart') { + onload(); } } chrome.runtime.onMessageExternal.addListener(handleMessage); +chrome.runtime.onMessage.addListener(handleMessage); diff --git a/parseSettings.js b/parseSettings.js index 1c6afbe..e3e64e3 100644 --- a/parseSettings.js +++ b/parseSettings.js @@ -28,16 +28,8 @@ function convertServerSettingsToUrl(serverSettings, launchUrl) { queryString.push('env=' + serverSettings.env); } } - - //if no environment set then default to production - var envIndex = queryString.findIndex(function(item) { - return /^env=/.test(item); - }); - if (envIndex < 0) { - queryString.push('env=production'); - } + queryString.push('platform=chromeApp'); url += (url.indexOf('?') < 0 ? '?' : '&') + queryString.join('&'); - return url; }