Skip to content
Advertisement

toLocaleString() doesn’t work in Safari browser

I used toLocaleString() method to input money comma in `javascript. But the problem is, IE and chrome browser result correctly except Safari browser. I delete cache several times but still doesn’t work.

JavaScript

Advertisement

Answer

The issue here is that number.toLocaleString is implemented differently on different browsers. On Safari, it chooses not to display with the person-friendly formatting we’re used to. It is supported on safari, but its implementation isn’t the same as IE, Chrome, or Firefox. See this link: http://forums.asp.net/t/2031925.aspx?toLocaleString+function+is+inconsistent+with+browser+

Also, Safari doesn’t support using the locale parameter with toLocaleString, in case you tried setting that: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement