From b50527b01d5001a3871d7156da41577a767cfa8d Mon Sep 17 00:00:00 2001 From: Yuya Ochiai Date: Thu, 8 Oct 2015 23:19:58 +0900 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E4=BB=98=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=AA=E3=81=A9=E3=81=AE=E3=80=81=E3=83=9B=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=81=8C=E5=90=8C=E3=81=98=E3=83=AA=E3=83=B3=E3=82=AF?= =?UTF-8?q?=E3=82=92=E6=96=B0=E3=81=97=E3=81=84=E3=82=A6=E3=82=A3=E3=83=B3?= =?UTF-8?q?=E3=83=89=E3=82=A6=E3=81=A7=E9=96=8B=E3=81=8F=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=81=AB=E3=81=AFBrowserWindow=E3=81=A7=E9=96=8B=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index cd661bbc..8d6d87ab 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,21 @@ 'use strict'; var remote = require('remote'); +var url = require('url'); var webView = document.getElementById('mainWebview'); -// Open in default browser. +// Open external link in default browser. webView.addEventListener('new-window', function(e) { - require('shell').openExternal(e.url); + var currentUrl = url.parse(webView.getUrl()); + var destUrl = url.parse(e.url); + // Open in browserWindow. for exmaple, attached files. + if(currentUrl.host === destUrl.host){ + window.open(e.url); + } + else{ + require('shell').openExternal(e.url); + } }); // Count unread channels.