new URL(location.href) doesn't work in IE

后端 未结 9 1631
心在旅途
心在旅途 2020-12-10 23:52

I am facing to problem with method new URL(\'address\') in IE.

I have this code:

var href =  location.href;
var hrefParams = new URL(href);
var api =         


        
9条回答
  •  情话喂你
    2020-12-11 00:53

    Here's another polyfill specifically for the URL api, intended to work exactly as it does in modern browsers and only run if needed. This way you don't need to use a separate function that will be obsolete once you decide to drop support for IE.

    Gist Page: https://gist.github.com/RyanG26/def0a520ed43c6c465d9a6518161bc7c

提交回复
热议问题