Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9203413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:28:07+00:00 2026-06-17T23:28:07+00:00

I used to rely on var supportsTouch = ‘ontouchstart’ in document; to test for

  • 0

I used to rely on

var supportsTouch = 'ontouchstart' in document;

to test for touch support in mobile and desktop browsers. Based on that test I bind eventListeners to click- or touch-events. This works fine in ALL current browser versions but the latest update to Chrome Canary (24.0.1275.0 canary) and of course the DEV version fail this test.

I checked on the current modernizr test but that returns a false positive as well, meaning it states that chrome supports touch even though the feature is disabled.

My current workaround is to test for any kind of mobile browser first and only if that returns positive uses the above test to check for touch. Downside of this is that you cannot use the handy “emulate touch events” option in chrome’s dev-tools. Ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:28:08+00:00Added an answer on June 17, 2026 at 11:28 pm

    Short answer: Your test will work again now in any current of Chrome. But probably not forever.

    Long answer:

    The Chrome team wanted to add touch events into desktop browsers, because of the growing number of desktops with touch-capable screens. So they did – probably around the time of 24.0 Canary. They then found that loads of people were doing what you’re doing to “detect touch devices”. The problem with this is you’re only testing if the browser supports touch events, not the device (same goes for Modernizr.touch). More specifically, just the W3C/Apple TouchEvents API.

    They didn’t want to ship different versions of Chrome for touch/non-touch, so they made it so they only enable the touch APIs if they detect a touch device on startup (discussed here: http://code.google.com/p/chromium/issues/detail?id=152149).

    So now your test will work again… BUT – if you want to future-proof yourself, you might want to change your approach. Here’s why:

    1. Not all browsers will perform this switch that Chrome does.

    2. Touch capability is becoming a dynamic feature: with Microsoft Surface etc you can unplug from keyboard and mouse and go touch-only, users may have touch monitors connected via KVM switches which won’t be detected at startup, etc. Browser vendors don’t want to make APIs appear and disappear – that’d be a nightmare – so at some point the Chrome guys will probably permanently enable the TouchEvents APIs on all devices. That test will start throwing “false positives” again.

    Instead, look at the PointerEvents API, which gives a common event interface for mouse, touch and stylus inputs. If you’re thinking of making buttons bigger for touch interfaces etc, there’s a pointer media query spec too (and a hover one), which will appear in browsers soon – this differentiates between different accuracies of input devices – none/coarse/fine – and being dynamic will let you adjust your styles based on the connected pointer devices, as they’re connected/disconnected. Very cool.

    Modernizr v3.0 (dropping within the next few weeks) will have a couple of relevant changes here:

    • A detect for the PointerEvents API is being added
    • Modernizr.touch is being renamed Modernizr.touchevents to better represent what it means

    So I’d consider using PointerEvents if available (which it already is in IE10), falling back to a Modernizr.touchevents switch if not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Used code I found on SO to use the COM based Acrobat Reader to
I used Jquery to insert a variable to div. Please check my code. var
Javascript objects can be used as maps. The following all is valid code: var
In the past, I used to rely on hash for inline navigation, for example:
Used to be quite happy with the Ctrl + Shift + F10 shortcut in
Anybody used Neural Network approaches for clustering data? Particularly ART Neural Network (Adaptive Resonance
I used the phonegap website to create an IPA file. Now I want to
Having used storyboards for a while now I have found them extremely useful however,
I used ReconstructMe to scan my first half body (arm and head). The result
I used Session[EmpName] = Convert.ToString(Request.QueryString[1]); lblEmployeeName.Text = Session[EmpName].ToString; to show the data in label

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.