javascript - Gracefully Handle Tel URL -
i have link on website:
<a href="tel:0123456789">call me, maybe</a>
that's great browsers can initiate calls degrades elegance of hippopotamus. like:
<h1>the address wasn't understood</h1>
i thought of attaching on onclick
listener , showing popup number. however, although listener runs, browser still follows url (and shows error) , i don't think there's reliable way detect whether there's tel:
protocol handler.
is there solution this?
i think work see if device automatically wraps telephone number.
<div id="testtel" style="display:none">+1 (111) 111-1111</div> var istelsupported = (function () { var div = document.queryselector("#testtel"), hasanchor = document.getelementsbytagname("a").length > 0; div.parentnode.removechild(div); return hasanchor; }()); alert(istelsupported);
Comments
Post a Comment