Search code examples
javascriptangularinternet-explorer-11polyfills

URL Polyfill for IE11


I am creating a URL in my angular app using new URL as below. This works on all browsers except IE11.

So I tried to add "url-polyfill" to my "package.json" and used import 'url-polyfill' in polyfills.ts file.

But still i am getting object doesn't support action error for this line in IE11. Can anyone provide some thoughts on what i am doing wrong here.

 url = new URL(url).pathname.toLowerCase()

Solution

  • Angular includes imports to core-js@3 (you don't need to install something), so try these polyfills instead:

    import 'core-js/features/url';
    import 'core-js/features/url-search-params';