|
|
|
@ -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) { |
|
|
|
|