From 47d9bf0b9b74bded2fba0cb151f1300ef5dfeff4 Mon Sep 17 00:00:00 2001 From: guybedford Date: Sat, 13 Jun 2015 15:28:30 +0200 Subject: [PATCH] feature test URL support --- lib/wrapper-end.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/wrapper-end.js b/lib/wrapper-end.js index a4a959c1..a94d6435 100644 --- a/lib/wrapper-end.js +++ b/lib/wrapper-end.js @@ -1,7 +1,12 @@ } // auto-load Promise and URL polyfills if needed in the browser -if (typeof Promise === 'undefined' || (typeof URL !== 'function' && typeof URLPolyfill !== 'function')) { +try { + var hasURL = typeof URLPolyfill != 'undefined' || typeof URL != 'undefined' && new URL('test:///').protocol == 'test:'; +} +catch(e) {} + +if (typeof Promise === 'undefined' || !hasURL) { // document.write if (typeof document !== 'undefined') { var scripts = document.getElementsByTagName('script');