diff options
-rw-r--r-- | src/webview/recipe.js | 26 |
1 files changed, 26 insertions, 0 deletions
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(); | |||
196 | const originalWindowOpen = window.open; | 196 | const originalWindowOpen = window.open; |
197 | 197 | ||
198 | window.open = (url, frameName, features) => { | 198 | window.open = (url, frameName, features) => { |
199 | if (!url && !frameName && !features) { | ||
200 | // The service hasn't yet supplied a URL (as used in Skype). | ||
201 | // Return a new dummy window object and wait for the service to change the properties | ||
202 | const newWindow = { | ||
203 | location: { | ||
204 | href: '', | ||
205 | }, | ||
206 | }; | ||
207 | |||
208 | const checkInterval = setInterval(() => { | ||
209 | // Has the service changed the URL yet? | ||
210 | if (newWindow.location.href !== '') { | ||
211 | // Open the new URL | ||
212 | window.open(newWindow.location.href); | ||
213 | clearInterval(checkInterval); | ||
214 | } | ||
215 | }, 0); | ||
216 | |||
217 | setTimeout(() => { | ||
218 | // Stop checking for location changes after 1 second | ||
219 | clearInterval(checkInterval); | ||
220 | }, 1000); | ||
221 | |||
222 | return newWindow; | ||
223 | } | ||
224 | |||
199 | // We need to differentiate if the link should be opened in a popup or in the systems default browser | 225 | // We need to differentiate if the link should be opened in a popup or in the systems default browser |
200 | if (!frameName && !features) { | 226 | if (!frameName && !features) { |
201 | return ipcRenderer.sendToHost('new-window', url); | 227 | return ipcRenderer.sendToHost('new-window', url); |