You might want to do 

    if (document.documentElement.lang === (navigator.language || navigator.userLanguage))

and BTW, `userLanguage` is not for just old IE but all IEs.