Browse Source

Fix the deep link logic in WebView.js.

pull/3202/head
TheGoddessInari 3 years ago
parent
commit
09a86b4e78
No known key found for this signature in database
GPG Key ID: 1209B1B7632D69A
  1. 6
      app/ux/WebView.js

6
app/ux/WebView.js

@ -259,11 +259,13 @@ Ext.define('Hamsket.ux.WebView',{
// Open links in default browser
webview.addEventListener('new-window', function (e) {
e.preventDefault();
const protocol = require('url').URL(e.url).protocol;
const { URL } = require('url');
const url = new URL(e.url);
const protocol = url.protocol;
// Block some Deep links to prevent that open its app (Ex: Slack)
if (['slack:'].includes(protocol)) return;
// Allow Deep links
if (!['http:', 'https:', 'about:'].includes(protocol)) return require('electron').shell.openExternal(e.url);
if (!['http:', 'https:', 'about:'].includes(protocol)) return require('electron').shell.openExternal(url.href);
});
webview.addEventListener('will-navigate', function(e, url) {

Loading…
Cancel
Save