// Определяем тип устройства.
function is_touch_device() {
	return (('ontouchstart' in window)
		|| (navigator.MaxTouchPoints > 0)
		|| (navigator.msMaxTouchPoints > 0));
}
if (!is_touch_device()) {
	alert("Desctop");
}
else alert("Mobile");
Пользуйтесь друзья