Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q140 Is there a way of telling which language the users browser is using?

You are here: irt.org | FAQ | JavaScript | Misc | Q140 [ previous next ]

The following works in Netscape 4 and Explorer 4:

<SCRIPT LANGUAGE="JavaScript1.2"><!--
if (navigator.appName == 'Netscape')
    var language = navigator.language;
else
    var language = navigator.browserLanguage;

var code = language.substring(0,2);
//--></SCRIPT>

©2018 Martin Webb