SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to check if an event handler is supported?

    I've created an iPhone web app that relies on the ontouchstart event handler. I chose this over onclick because ontouchstart reacts faster. Now an iPhone user with an old firmware version told me it doesn't work for him.

    To solve the problem with old firmware and make the app compatible with other smartphones, while keeping the benefit of ontouchstart for those whose phone supports it, I want to do this:
    Check if ontouchstart is supported. If it isn't replace it by onclick. I've googled for this extensively, but can't find out how to check if the ontouchstart event handler is supported. Does anyone kwow a way?

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could just assign both event handlers, and have the ontouchstart handler remove the onclick handler.

  3. #3
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Crmalibu, you're a genius :-) That's what I'll do.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •