I am wondering if there is anyway that I can use javascript or jquery to pull information about the default currency symbol for a user. I know that the information is stored in the registry in windows, but I'm not sure about Mac or Linux machines and I'm not sure how I access that information. I'm thinking about using this feature to write a game that detects the system's stored value for currency and displays that symbol to the player for purchases and sales. It is something that will be played internationally (I hope) so it will have to be able to use any currency symbol (eg $ or ¢ or £ or ₤ or € etc)...
As far as I know, There are no libraries or ECMA script to help with this.
I would go about it as:
Get the locale of the visitor and implement custom logic to show currency based on the given locale. You can try implementing the logic with help of Accept-Language header. Though, there are best practices when using Accept-Language header.
http://www.w3.org/International/questions/qa-accept-lang-locales
If targeting Modern browser, One can also use geolocation to determine the location and have a custom logic to show currency based on the location. Though, users can deny permission to get the geo location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With