Intl is not defined firefox

醉酒当歌 提交于 2020-01-04 03:43:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!