diff options
author | 2019-09-24 10:01:22 +0200 | |
---|---|---|
committer | 2019-09-24 10:01:22 +0200 | |
commit | 438b9fe4393ef8518809c2ac36f492fbe3db0b5e (patch) | |
tree | 5cf72eb2c7b759f49f055b0187e9dec231cb04db /src/webview | |
parent | Add ignore list for darkmode (diff) | |
download | ferdium-app-438b9fe4393ef8518809c2ac36f492fbe3db0b5e.tar.gz ferdium-app-438b9fe4393ef8518809c2ac36f492fbe3db0b5e.tar.zst ferdium-app-438b9fe4393ef8518809c2ac36f492fbe3db0b5e.zip |
Implement Skype link fix
Diffstat (limited to 'src/webview')
-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); |