Viewing Language detection
Language detection
User: Stefano R. 6 years ago
|
|
Hello. I'm trying to have my multilingual website served in the user's language. I'm already using this js snippet <script> var userLang = navigator.language || navigator.userLanguage; userLang = userLang.substr(0, 2); if (userLang == “it”) { location.href = 'http://vipsresidence.it/ita/desktop/errore.html'; } else if (userLang == “fr”) { location.href = 'http://vipsresidence.it/fra/desktop/errore.html'; } else if (userLang == “ru”) { location.href = 'http://vipsresidence.it/rus/desktop/errore.html'; } else if (userLang == “zh”) { location.href = 'http://vipsresidence.it/chn/desktop/errore.html'; } else { location.href = 'http://vipsresidence.it/eng/desktop/errore.html'; } </script> to serve the correct error page (403 and 404 http code). The code is input in the header section of the Page Inspector of generic error page that only serves to redirect to the language specific ones. It works fine, but if I try to do the same with the home page, it doesn't work anymore. I understand it's probably a conflict with EverWeb's own use of jQuery, but even using something like <script type="text/java script" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script> doesn't solve the issue. Any ideas? Thank you. Stefano |
|
Post Reply |
You must login or signup to post. |