From 9012e98ba7538cd8286f703733ec0867b48db1b0 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Fri, 21 Apr 2017 18:29:29 -0700 Subject: [PATCH] [fix] support 'mailto:' URLs in 'Linking' --- src/apis/Linking/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apis/Linking/index.js b/src/apis/Linking/index.js index c2e9ecfd..7c6a24b3 100644 --- a/src/apis/Linking/index.js +++ b/src/apis/Linking/index.js @@ -28,6 +28,7 @@ const Linking = { * https://mathiasbynens.github.io/rel-noopener/ */ const iframeOpen = url => { + const noOpener = url.indexOf('mailto:') !== 0; const iframe = document.createElement('iframe'); iframe.style.display = 'none'; document.body.appendChild(iframe); @@ -36,7 +37,7 @@ const iframeOpen = url => { const script = iframeDoc.createElement('script'); script.text = ` window.parent = null; window.top = null; window.frameElement = null; - var child = window.open("${url}"); child.opener = null; + var child = window.open("${url}"); ${noOpener && 'child.opener = null'}; `; iframeDoc.body.appendChild(script); document.body.removeChild(iframe);