最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - IE11 Object doesn't support property or method 'normalize' - Stack Overflow

programmeradmin0浏览0评论

I'm using string.normalize to remove diacritics from a string. This javascript works fine in other browsers, but in IE11 it is throwing an error that says "Object doesn't support property or method 'normalize'

function removeDiacritics(text) {
    return text.normalize('NFD').replace(/[\u0300-\u036f]/g, "");
}

I'm using string.normalize to remove diacritics from a string. This javascript works fine in other browsers, but in IE11 it is throwing an error that says "Object doesn't support property or method 'normalize'

function removeDiacritics(text) {
    return text.normalize('NFD').replace(/[\u0300-\u036f]/g, "");
}
Share Improve this question asked Jan 17, 2019 at 19:15 Erica Stockwell-AlpertErica Stockwell-Alpert 4,86311 gold badges67 silver badges139 bronze badges 2
  • 1 Right, it's not supported. developer.mozilla/en-US/docs/Web/JavaScript/Reference/… What is your question? – jmargolisvt Commented Jan 17, 2019 at 19:17
  • 1 How to remove diacritics in IE? Or make it not throw an error? – Erica Stockwell-Alpert Commented Jan 17, 2019 at 19:18
Add a ment  | 

2 Answers 2

Reset to default 6

normalize was only added in ES2015. IE11 doesn't support virtually any of ES2015, including normalize. You'll need a polyfill, or to not use normalize. (The core.js project doesn't have a polyfill for it, but mentions a module called unorm that does normalization...)

Adding the unorm polyfill will provide support for normalize.

发布评论

评论列表(0)

  1. 暂无评论