Can you detect whether a device has phone capabilities (e.g. it can make voice calls/SMS) with JavaScript?
javascript
Solution
I havent seen an obvious way to see that `sms:` and `tel:` links get special treatment.
Update: @janogosteve below has confirmed there is currently no reliable feature detect. This looks undetectable.
Here's a comprehensive way to check this feature detect. (Read jangosteve comment below!)
- make a test page with two of those links and a regular http link
- grab the elements and then traverse all their properties, copy it all over to an object..
- also `getComputedStyle` info for a bunch of details on them and throw that into an object as well
- `JSON.stringify`( that stuff so you can deal with it later on)
Do the above on an iOS device and in desktop Safari/Chrome
Then `JSON.parse` them back into objects... and use https://github.com/NV/objectDiff.js to see if you can spot any differences at all.
Problem
Is there any way to detect whether a mobile device is capable of making voice calls / SMS messages? This is important when applying `tel:` and `sms:` links in a web page. It is not enough to merely detect mobile, since tablets can't make calls, iTouch can't make calls, etc. I'm not interested in mobile detection hacks using device size, UA string detection, etc. I want to use feature detection to determine if the device is capable of voice calls / SMS text messaging. I'd love a universal solution, but am mainly interested in iOS / Android.