checkIfURLIsSupported = function () {
        try {
            var u = new global.URL('b', 'http://a');
            u.pathname = 'c%20d';
            return (u.href === 'http://a/c%20d') && u.searchParams;
        } catch (e) {
            return false;
        }
    }
Polyfill URL

Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js