專案出於多語言版本的考慮,前台使用easyui,透過取得瀏覽器語言版本,來相對的載入easyui語言包,easyui預設語言包en-US
程式碼如下
<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>