# Checking for touch support

The Web Runtime (WRT) API does not provide a way to detect whether a device is touch-enabled. You can use simple but error-prone heuristics to detect it.

The first S60 touch UI devices have bigger screen resolution than older devices. Therefore, if the queried screen resolution is 360 x 640 (or 640 x 360 in landscape orientation), you can assume that touch UI is supported. On devices that support WRT 1.1, you can use the`DisplayResolution` attribute of the `ISysInfo.GetInfo()` method to determine screen resolution.

You can also use the screen width and height attributes to determine screen resolution:

    // Identifies the device by querying its resolution
    function detectResolution() {
        var screenWidth = screen.width;
        var screenHeight = screen.height;

        if (screenWidth == 240 && screenHeight == 320) {
            resolution = RESOLUTION_QVGA_PORTRAIT;
        } else if (screenWidth == 320 && screenHeight == 240) {
            resolution = RESOLUTION_QVGA_LANDSCAPE;
        } else if (screenWidth == 360 && screenHeight == 640) {
            resolution = RESOLUTION_NHD_PORTRAIT;
        } else if (screenWidth == 640 && screenHeight == 360) {
            resolution = RESOLUTION_NHD_LANDSCAPE;
        } else if (screenWidth == 800 && screenHeight == 352) {
            resolution = RESOLUTION_E90_LANDSCAPE;
        } else {
            resolution = RESOLUTION_UNDEFINED;
        }
    }

    // Detects whether touch UI is supported
    function detectTouchUI() {
    		// Query the device resolution to determine whether this is a touch device.
        if (resolution == RESOLUTION_NHD_LANDSCAPE ||
            resolution == RESOLUTION_NHD_PORTRAIT) {
            touchSupported = true;
        } else {
            touchSupported = false;
    		}
    }