Skip to content

Latest commit

 

History

History
21 lines (13 loc) · 468 Bytes

File metadata and controls

21 lines (13 loc) · 468 Bytes

Title: Detect Touch devices using JavaScript


Date: 1405156020


Authors: rasshofer


Text:

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);
}