I know that there are lots of similar questions.
Currently, I use the below code to detect touch screen devices and I mark them as mobile devices.
function isMobile() {
try {
document.createEvent("TouchEvent");
console.log("mobile");
return true;
}
catch (e) {
console.log("pc");
return false;
}
}
It works good on mobile devices but what about touch screen PCs that also have a keyboard and mouse? How can I differentiate them?
Since I don't have a touch screen PC I am not able to test and solve this issue.
I want to determine if it is a mobile device such as a mobile phone or tablet basically devices that have no mouse and keyboard or it is a PC that has a keyboard and mouse.