Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 09a86b4

Browse files
Fix the deep link logic in WebView.js.
1 parent 3de8091 commit 09a86b4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/ux/WebView.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,13 @@ Ext.define('Hamsket.ux.WebView',{
259259
// Open links in default browser
260260
webview.addEventListener('new-window', function (e) {
261261
e.preventDefault();
262-
const protocol = require('url').URL(e.url).protocol;
262+
const { URL } = require('url');
263+
const url = new URL(e.url);
264+
const protocol = url.protocol;
263265
// Block some Deep links to prevent that open its app (Ex: Slack)
264266
if (['slack:'].includes(protocol)) return;
265267
// Allow Deep links
266-
if (!['http:', 'https:', 'about:'].includes(protocol)) return require('electron').shell.openExternal(e.url);
268+
if (!['http:', 'https:', 'about:'].includes(protocol)) return require('electron').shell.openExternal(url.href);
267269
});
268270

269271
webview.addEventListener('will-navigate', function(e, url) {

0 commit comments

Comments
 (0)