javascript - Phonegap: Globalization: How to redirect to .html page in this function? -


i've got function alert preferred language on device:

function checklanguage() {   navigator.globalization.getpreferredlanguage(     function (language) {alert('language: ' + language.value + '\n');},     function () {alert('error getting language\n');}   ); } 

it returns example: "deutsch" .. or.. "english"

i want redirect .html document if value e.g "english"

i tried this:

function checklanguage() {   navigator.globalization.getpreferredlanguage(     function (language) {     if(language.value == english) {window.location = "newdocument.html"; } }     function () {alert('error getting language\n');}   ); } 

but didn't work.

there syntax error. try :

function checklanguage() {    navigator.globalization.getpreferredlanguage(        function (language)        {            if(language.value == "english")            {                window.location.replace("newdocument.html");            }        },        function ()        {            alert('error getting language\n');        }    ); } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -