3

Is it possible to detect if a device can make a phonecall or not? I have a webpage with a list of phone numbers. I want to make them clickable if the device can call, using the tel: link. When I click on such a link in my desktop browser, Firefox reports:

The address wasn't understood

Firefox doesn't know how to open this address, because one of the following protocols (tel) isn't associated with any program or is not allowed in this context.

I know about mobile device detection. This does not what I want, because most tablets are mobile but can't make a phone call.

Questions

  • Is it possible to detect if a device can make a phone call using Javascript or HTML, and if so how?
  • If this can't be done, what's the best way to handle this?
Community
  • 1
  • 1
SPRBRN
  • 2,406
  • 4
  • 35
  • 48
  • 1
    You don't have to do anything. Most devices that have browsers and can make calls will recognise a phone number in a page. So if it's clicked on (or some other suitable gesture), the device will highlight the whole number and offer to call it. – RobG Apr 30 '15 at 10:46

1 Answers1

0

I think iOS does this automatically, not sure about the other OS. But if you just check the devices by their name using simple Javascript/jQuery, wouldn't that be sufficient?

Something like this:

$.browser.device = (/android|webos|iphone|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
hbulens
  • 1,872
  • 3
  • 24
  • 45
  • that would not detect the difference between a tablet (that cannot handle phonecalls) and a phone (a device that usually can detect calls) – raoel Aug 24 '18 at 10:08