項目出於多語言版本的考慮,前台使用easyui,通過獲取浏覽器語言版本,來相對的加載easyui語言包,easyui默認語言包en-US
代碼如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 <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>