From 438b9fe4393ef8518809c2ac36f492fbe3db0b5e Mon Sep 17 00:00:00 2001 From: vantezzen Date: Tue, 24 Sep 2019 10:01:22 +0200 Subject: Implement Skype link fix --- src/webview/recipe.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/webview/recipe.js') diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 0eae279c6..b30199f03 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -196,6 +196,32 @@ new RecipeController(); const originalWindowOpen = window.open; window.open = (url, frameName, features) => { + if (!url && !frameName && !features) { + // The service hasn't yet supplied a URL (as used in Skype). + // Return a new dummy window object and wait for the service to change the properties + const newWindow = { + location: { + href: '', + }, + }; + + const checkInterval = setInterval(() => { + // Has the service changed the URL yet? + if (newWindow.location.href !== '') { + // Open the new URL + window.open(newWindow.location.href); + clearInterval(checkInterval); + } + }, 0); + + setTimeout(() => { + // Stop checking for location changes after 1 second + clearInterval(checkInterval); + }, 1000); + + return newWindow; + } + // We need to differentiate if the link should be opened in a popup or in the systems default browser if (!frameName && !features) { return ipcRenderer.sendToHost('new-window', url); -- cgit v1.2.3-54-g00ecf