From dd23b095699da704e3b91b4415c7b3519753939d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 30 Mar 2016 16:55:10 -0700 Subject: [PATCH] Only open http/https links --- docs/api/web-view-tag.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index cba48e40db17..ff9013023c15 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -606,7 +606,10 @@ The following example code opens the new url in system's default browser. ```javascript webview.addEventListener('new-window', function(e) { - require('electron').shell.openExternal(e.url); + var protocol = require('url').parse(e.url).protocol; + if (protocol === 'http:' || protocol === 'https:') { + require('electron').shell.openExternal(e.url); + } }); ```