I have simple HTML and JS code. When the user selects the Italian language option, then the JS code dynamically loads the external JS file language_it.js
.
<html> <head> <script> function ChangePageLanguage() { var e = document.getElementById("langDD"); var lang = e.options[e.selectedIndex].value; if (lang == "it") { var scrptE = document.createElement("script"); scrptE.setAttribute("type", "text/javascript"); scrptE.setAttribute("language", "JavaScript"); scrptE.setAttribute("src", "language_it.js"); var head = document.getElementsByTagName("head")[0]; head.appendChild(scrptE); } } </script> </head> <body> <select onchange="ChangePageLanguage()" id="langDD"> <option value="en">English</option> <option value="it">Italian</option> </select> </body> </html>
language_it.js
has the following line of code:
alert ("Italian");
It works fine in Firefox, but if I change the contents of language_it.js
, then Chrome
will not display the updated content unless I restart the index.html page in Chrome
. Is there a solution to this problem?
Azeem source share