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');