Language detection for iPhone - Can anyone teach me how to detection iPhone browser language using javascript via html?

I am working on a multi-language website with 18 languages. My language browser-language based detection script works fine on PC but not mobile devices. Can anyone help?

<!--//

if (navigator.appName == 'Netscape')

var language = navigator.language;

else

var language = navigator.browserLanguage;

if (language.indexOf('en') > -1) document.location.href = 'en/index.php';

else if (language.indexOf('zh-TW') > -1) document.location.href = 'zh/index.php';

else if (language.indexOf('zh-Hant') > -1) document.location.href = 'zh/index.php';

else if (language.indexOf('zh-CN') > -1) document.location.href = 'zh_CN/index.php';

else if (language.indexOf('zh-Hans') > -1) document.location.href = 'zh_CN/index.php';

else document.location.href = 'en/index.php';

// End -->

iPhone 4

Posted on Oct 17, 2012 8:50 PM

Reply
2 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Language detection for iPhone - Can anyone teach me how to detection iPhone browser language using javascript via html?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.