问题
I have following java scripts code which runing well in chrome but fail in firefox and IE. the error message of FF is 'ReferenceError: Intl is not defined' the error message of IE is 'SCRIPT5009: 'Intl' is undefined '
<script>
var co = new Intl.Collator('pinyin');
console.log(co);
var co = new Intl.Collator('zh-Hans');
console.log(co);
var co = new Intl.Collator('zh-Hans-CN');
console.log(co);
</script>
I just wonder why the standard object Intl can't be refer in FF or IE? did I miss something?
回答1:
It's a new API that's not supported by Firefox. Here is the MDN page and its section about browser support for the feature. Note that it's also unsupported by IE prior to IE 11, and it's unsupported by desktop and iOS Safari.
回答2:
Here is the current status of Intl support:
http://mihai-nita.net/2013/07/28/javascript-internationalization-api/
来源:https://stackoverflow.com/questions/18128836/intl-is-not-defined-firefox