One way to solve this problem is to take userAgent - navigator.userAgent and run the regular expression when searching for the language.
Example ua string for Android (from http://www.gtrifonov.com/2011/04/15/google-android-user-agent-strings-2/ ):
Mozilla / 5.0 (Linux, U, Android 2.0.1, en-us; Droid Build / ESD56) AppleWebKit / 530.17 (KHTML, e.g. Gecko) Version /4.0 Mobile Safari / 530.17
so just map the language: navigator.userAgent.match(/[az]{2}-[az]{2}/) , which returns en-us
If you want to be truly secure, you can match the presence of Android 2.0.1; immediately preceding language. A regular expression for this would be as follows:
navigator.userAgent.match(/Android \d+(?:\.\d+){1,2}; [az]{2}-[az]{2}/).toString().match(/[az]{2}-[az]{2}/)
wmute source share