Hi all! :)
I need a way to detect in Javascript, when the user is running Internet Explorer 10 or newer, whether they're browsing my website using a Windowslaptop vs a tablet.
I wrote this Javascript function to detect a Windows tablet:
function is_win_tablet()
{
return (navigator.userAgent.toLowerCase().indexOf("windows nt") != -1 &&
navigator.userAgent.toLowerCase().indexOf("touch") != -1);
}However, it's wrong. When I'm using my laptop with touch screen, this function detects it as a tablet.
How do I distinguish if the user is viewing my website with IE on a laptop vs a tablet? Thank you in advance for your help! :)