Home >Web Front-end >JS Tutorial >JS gets the browser language and dynamically loads the JS file sample code_javascript skills
For the sake of multi-language version, the project uses easyui at the front end. By getting the browser language version, the easyui language package is loaded relatively. The default language package of easyui is en-US
The code is as follows
<script type="text/javascript"> //ie if (navigator.browserLanguage != "undefined" && navigator.browserLanguage != null) { if (navigator.systemLanguage == "zh-CN") { document.write("<script src='jquery-easyui/locale/easyui-lang-zh_CN.js'><\/script>"); } } //firefox、chrome,360 else { if (navigator.language == "zh-CN") { document.write("<script src='jquery-easyui/locale/easyui-lang-zh_CN.js'><\/script>"); } } </script>