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
2 Answers
Reset to default 6normalize
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.