From e2b1f0d4d5b5526e61184e2c24186d422b6f8843 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Wed, 20 Sep 2017 20:18:05 +0900 Subject: [PATCH] open cross-origin links by background --- src/content/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/content/index.js b/src/content/index.js index 571a927..5f50a72 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -27,6 +27,15 @@ const startFollows = (newTab) => { newTab }); } + if (element.href.startsWith('http://') || + element.href.startsWith('https://') || + element.href.startsWith('ftp://')) { + return browser.runtime.sendMessage({ + type: messages.OPEN_URL, + url: element.href, + newTab + }); + } return element.click(); case 'input': switch (element.type) {