Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (13 sloc) 468 Bytes

Title: Detect Touch devices using JavaScript

Date: 1405156020

Authors: rasshofer


The following function allows the detection of touch devices (smartphones, tablets, …) using JavaScript. As an example, this allows you to offer certain actions on a website or web application only for appropriate devices like disabling hover effects for touch devices.

function isTouchDevice() {
	return ('ontouchstart' in window);
You can’t perform that action at this time.