24 lines
615 B
JavaScript
24 lines
615 B
JavaScript
export default {
|
|
name: 'navigator',
|
|
|
|
lookup: function lookup(options) {
|
|
var found = [];
|
|
|
|
if (typeof navigator !== 'undefined') {
|
|
if (navigator.languages) {
|
|
// chrome only; not an array, so can't use .push.apply instead of iterating
|
|
for (var i = 0; i < navigator.languages.length; i++) {
|
|
found.push(navigator.languages[i]);
|
|
}
|
|
}
|
|
if (navigator.userLanguage) {
|
|
found.push(navigator.userLanguage);
|
|
}
|
|
if (navigator.language) {
|
|
found.push(navigator.language);
|
|
}
|
|
}
|
|
|
|
return found.length > 0 ? found : undefined;
|
|
}
|
|
}; |