From 9f30e007c0bde2dbb0a9bc3e5afc1393d7b72eb2 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Wed, 15 Mar 2017 19:12:52 -0400 Subject: [PATCH] open http links in external app (probably browser) --- ui/js/app.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/js/app.js b/ui/js/app.js index ab5fc1c3b..466fde6ad 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -22,7 +22,7 @@ import {Modal, ExpandableModal} from './component/modal.js'; import {Link} from './component/link.js'; -const {remote, ipcRenderer} = require('electron'); +const {remote, ipcRenderer, shell} = require('electron'); const {download} = remote.require('electron-dl'); @@ -60,6 +60,19 @@ var App = React.createClass({ this.alertError(event.detail); }); + //open links in external browser + document.addEventListener('click', function(event) { + var target = event.target; + while (target && target !== document) { + if (target.matches('a[href^="http"]')) { + event.preventDefault(); + shell.openExternal(target.href); + return; + } + target = target.parentNode; + } + }); + lbry.checkNewVersionAvailable((isAvailable) => { if (!isAvailable || sessionStorage.getItem('upgradeSkipped')) { return;