简体   繁体   English

IE11的URL Polyfill

[英]URL Polyfill for IE11

I am creating a URL in my angular app using new URL as below. 我正在使用以下新URL在我的角度应用程序中创建URL。 This works on all browsers except IE11. 此功能适用于除IE11之外的所有浏览器。

So I tried to add "url-polyfill" to my "package.json" and used import 'url-polyfill' in polyfills.ts file. 因此,我尝试将“ url-polyfill”添加到我的“ package.json”中,并在polyfills.ts文件中使用了导入“ url-polyfill”。

But still i am getting object doesn't support action error for this line in IE11. 但是我仍然在IE11中得到对象不支持此行的操作错误。 Can anyone provide some thoughts on what i am doing wrong here. 任何人都可以对我在这里做错的事情提供一些想法。

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

Angular includes imports to core-js@3 (you don't need to install something), so try these polyfills instead: Angular包括了对core-js @ 3的导入(您不需要安装任何东西),因此,请尝试使用这些polyfills:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM