Js code -redirecting on tablet

Hi,

I have this JS code:

<script>
function isMobileDevice() {
 return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1);
};
if (isMobileDevice()){
 window.location.href = 'https://promo.lokalnionline.pl/x2' // modify this for the "mobile" kite url
} else {
 window.location.href = 'https://informatorparafialny.pl/parafiawegry' // modify this for the "desktop" kite url
} 
</script>

Unfortunately on a tablet, the web page does not open for me. What should I add to this code to make it open on tablet, which opens from desktop?

I wanted that when typing the name of the site on the tablet the appropriate page would show up.