admin管理员组文章数量:1431037
I'm seeing an Intl not available
error in the JS console when my script runs the following code in Edge 15:
new Date().toLocaleDateString()
I'm a bit stumped by this. It is working just fine in Edge 14, and I can't find any reference to the internationalization API suddenly disappearing from Edge 15.
I'm not sure if this is the proper way to test it, but running window.hasOwnProperty("Intl")
in the console actually returns true
. To me this seems to indicate that Intl actually is there.
Anyone with more JS skills able to tell what is really going on here?
I'm seeing an Intl not available
error in the JS console when my script runs the following code in Edge 15:
new Date().toLocaleDateString()
I'm a bit stumped by this. It is working just fine in Edge 14, and I can't find any reference to the internationalization API suddenly disappearing from Edge 15.
I'm not sure if this is the proper way to test it, but running window.hasOwnProperty("Intl")
in the console actually returns true
. To me this seems to indicate that Intl actually is there.
Anyone with more JS skills able to tell what is really going on here?
Share Improve this question edited Jul 3, 2017 at 17:14 Bergi 667k161 gold badges1k silver badges1.5k bronze badges asked Jun 1, 2017 at 9:10 rogerkkrogerkk 5,7655 gold badges39 silver badges56 bronze badges 10- toLocaleDateString is actually part of ECMAScript (ECMA-262) so the error message is bogus. Support for the Intl object (ECMA-402) is required for support of the optional parameters. – RobG Commented Jun 1, 2017 at 9:28
- 1 Norsk again...... it seems to be a problem language/culture..... try adding a lang/xmllang attribute to the html tag AND include a http-equivalent content-language meta tag to your page. – Rob Parsons Commented Jun 4, 2017 at 19:30
- 1 Thanks Rob. I already have a <html lang="no">, and the way I understand it Content-Language on meta http-equiv should not be used at all? See w3/International/questions/qa-http-and-lang#quickanswer – rogerkk Commented Jun 6, 2017 at 10:04
- 1 Just checked in Edge, no such problem (Edge 40.15063.0.0). Maybe there was a bug? – Zero Commented Jun 6, 2017 at 15:12
- 1 try lang="nb" , see my answer at stackoverflow./questions/42576222/…. The http-equivalent content-language of "no" is for google translate which seems to require a content-language value for the from language query parameter. – Rob Parsons Commented Jun 10, 2017 at 9:30
3 Answers
Reset to default 3Make sure your JS code doesn't redefine standard Map
class.
We had almost the same problem, but with Intl.Collator
object instead. We couldn't use String.prototype.localeCompare("...", "locale")
because of this.
You can look at this codepen in Edge 15 and in other browsers for explanation: https://codepen.io/kgorob/pen/pweaWV.
P.S.
I'm not sure your problem is because of Map
class specifically, maybe it's some other standard JS class you are re-defining.
The problem is because of these lines in Chakracore code. Intl.js
is javascript file that is used internally to perform various internationalization specific operations. Since Map
is used, over-writing it before Intl.js
code executes (it is executed lazily), causes problem. This should be addressed soon.
As ksp's answer says, this is caused by Intl lazy-loading after Map is overwritten. Therefore, the easiest workaround is to just force it to initialise early, before other scripts run:
<html>
<head>
<script>Intl.DateTimeFormat</script>
...
Here is the issue in the Chakra repo: https://github./Microsoft/ChakraCore/issues/3189
本文标签: javascriptquotIntl not availablequot in Edge 15Stack Overflow
版权声明:本文标题:javascript - "Intl not available" in Edge 15 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745450540a2658861.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论