JS obtains the sample code of the JS file dynamically loaded by the browser language. js sample code
For the multi-language version of the project, easyui is used in the foreground to obtain the browser language version to load the easyui Language Pack. The easyui default language pack 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>
How to obtain the js files on the page loaded by the browser
In IE cache, you can also find the path to download from the source file code.
Dynamic Loading of JS files and functions
Ie seems to be like this. If the call is unsuccessful, it means that onload is executed before the script is loaded. (The requests dynamically generated by ie may not be added to the Request queue that affects onload ), you can monitor the onload events of dynamically created script labels. ie seems to be oncomplete and onreadystatechange. After loading, add a loaded identifier and call