Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I detect tel: links added by mobile safari?

We use jQuery to add a click handler to links that occur in part of our site, in order to track the event in Google analytics. We're seeing that some events are coming in from links that we haven't put there, and since they've all got HREFs along the lines of 1-234-567-890 I'm guessing the skype plugin has put them there which I've learnt are being added by mobile safari.

At the moment, our selector looks like this:

links = $('.linksection a');

How should I change it to exclude the tel: links?

like image 420
Simon Avatar asked Oct 12 '22 15:10

Simon


1 Answers

Assuming the plugin adds the links starting with tel:// you can use this code which filters out all links that start with tel:

$('a:not([href^="tel"])')

Example - http://jsfiddle.net/U2fR8/

like image 133
Richard Dalton Avatar answered Oct 19 '22 22:10

Richard Dalton