Start Online Training

Get access to all our video classes and support. That's 1818 training sessions in Joomla, Drupal, WordPress, Coding and SEO.
Prices start only at only 25 USD per month

Testimonials

Testimonials OSTrainingYou guys rock!"

~ Cheryl

 

Start a FREE 7 day trial! Get training videos and books, plus expert support:  

TOPIC: Mobile Phone Hyperlinks

Mobile Phone Hyperlinks 11 months 2 weeks ago #70732

  • WillRoz
  • WillRoz's Avatar
  • OFFLINE
  • Posts: 326
  • Thank you received: 2
Hi again,

In order to construct a link that automatically dials a phone number (via the dialer function of a phone) automatically, you use the following syntax:
<a href="tel:xxx-xxx-xxxx">xxx.xxx.xxxx</a>

The problem is that it won't work on a desktop computer or tablet that isn't a phone.

Is there any way to have the link redirect elsewhere if there's no dialer?

Thanks,
Will
Will Rosner
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70736

  • tessa
  • tessa's Avatar
  • OFFLINE
  • Posts: 4073
  • Thank you received: 144
Hi Will,

Where do you want it to redirect? You could use php conditions to do so...

Pseudo code:

if (device is phone or tablet)
{ echo "<a href='tel:xxx-xxx-xxx">xxx.xxx.xxxx</a>"; }

else { echo "<a href='blah'>Redirected Link</a>"; }


Something along those lines. You'd have to find out how to figure out what device it's on. :P
Warm Regards,

Tessa Mero



Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Last Edit: 11 months 2 weeks ago by tessa.
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70760

  • WillRoz
  • WillRoz's Avatar
  • OFFLINE
  • Posts: 326
  • Thank you received: 2
Hi Tessa,

I have the link in several places. It shows up on the website in the footer:
www.ablaze.biz

Depending on the browser it does different things.
Chrome: Does nothing - acts like a dead link; which is acceptable, I can live with that.
IE9: Leads to a 404 (generic browser page)
FF: Doesn't compute - says it's not associated with any software

It's also going in an email newsletter, so php is not a viable option for all of my circumstances.

From the newsletter link, it leads to a 404, but it's the 404 that's supplied with the Ganrty template we're using (as opposed to the generic one mentioned above). That's because the newsletter is being sent by AcyMail, so it's really looking for ablaze.biz/tel:xxx.xxx.xxxx.

As I'm writing this, I have an idea. I'll try a stock Joomla redirect for the above url and see if it might solve the problem. At least for the newsletters.

I'll report back.

Thanks,
Will
Will Rosner
Last Edit: 11 months 2 weeks ago by WillRoz.
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70761

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Posts: 19328
  • Thank you received: 528
Hi Will,

The following discussion might be of help too:
www.ostraining.com/support-forum/coding-...ber-on-a-smartphone/

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70772

  • WillRoz
  • WillRoz's Avatar
  • OFFLINE
  • Posts: 326
  • Thank you received: 2
Hi Nick,

Thanks for pointing me at that discussion. Following some of the information presented there, it looks like I want to use the following code:
if (!jQuery.browser.mobile) {
    jQuery('body').on('click', 'a[href^="tel:"]', function() {
            jQuery(this).attr('href', 
                jQuery(this).attr('href').replace(/^tel:/, 'callto:'));
    });
}

I'm just not sure where I should put it.

Any ideas?

Thanks,
Will
Will Rosner
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70775

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Posts: 19328
  • Thank you received: 528
You're welcome, Will! We're glad we can be of help!

You can try including it in some Javascript script tags and put it within your article.

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70778

  • WillRoz
  • WillRoz's Avatar
  • OFFLINE
  • Posts: 326
  • Thank you received: 2
Actually, a quick follow up... (and a cross-post)

The link created by detectmobilebrowsers.com/ is working for the email link. From phones it dials the number and from computers and tablets it leads me to the contact page. This is a totally acceptable solution.

So now I'm down to making the link in the footer work properly. When I use the same link from detectmobilebrowsers.com/, it tries to load the telephone number in a browser. That leads to my preceding question about where that code snippet belongs. I'll try adding it in the custom html module and see if it sticks.

Thanks,
Will
Will Rosner
Last Edit: 11 months 2 weeks ago by WillRoz.
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70792

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Posts: 19328
  • Thank you received: 528
Interesting. OK, let us know if the custom HTML module position works for you. That's a better option if you have the footer on every page.

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70827

  • WillRoz
  • WillRoz's Avatar
  • OFFLINE
  • Posts: 326
  • Thank you received: 2
Hey Nick,

A little follow-up.

After some initial testing, this whole scenario is much more complicated than it seems it should be on the surface. I think that one of the reasons is the multitude of devices on the market nowadays. If the only considerations were the phone and a computer things would be a bit simpler, but taking tablets into consideration kinda throws a wrench in the works.

A tablet registers as a mobile device, but doesn't have a dialer. Actually, that's not true for every tablet, my Transformer (and only personal experience) has a dialer as part of the Android OS, but no actual phone to dial. That's one of the major issues though. The client claimed the same experience on her iPad. The link tries to dial a number but with no phone to dial, the end user is left in limbo. Not exactly the desired result. I've left it that way in the footer for the time being (if you'd like to try it), but will still be looking into this further when time permits. Probably sometime the beginning of next week.

I'll recycle this thread if I find out anything interesting.

Thanks,
Will
Will Rosner
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70829

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Posts: 19328
  • Thank you received: 528
Hi Will,

Thanks for the update! Sounds good. The tel in your footer doesn't do anything for me in Chrome on the Mac. Another thing to throw into the mix, what happens when Skype is on?

At the very least, it's a good mental exercise working through these type of problems. I hope you're learning new things that you can apply later in projects :)

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Last Edit: 11 months 2 weeks ago by Nick.
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70831

  • WillRoz
  • WillRoz's Avatar
  • OFFLINE
  • Posts: 326
  • Thank you received: 2
LOL! Nick,

Mental exercise or mental anguish, the line gets blurry sometimes. :)

Really, my thoughts were to just do things the old fashioned way and actually look at the number and (gasp!) dial it with your finger!

I guess that's showing my age though...
Will Rosner
Please become a member of OSTraining to reply to this post.

Mobile Phone Hyperlinks 11 months 2 weeks ago #70833

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Posts: 19328
  • Thank you received: 528
LOL! I know exactly what you mean :)

Often times it's better to just keep things simple and move on to other tasks that might have a bigger impact for site visitors. Might be worth just tossing this one on the back burner for now, by the sounds of it. When I build things, I try to focus on areas that I get feedback from users that need improving. If you're not getting feedback that the number needs to be clickable, then perhaps just skip it.

Hope this helps, Will!

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of OSTraining to reply to this post.

 

Start a FREE 7 day trial! Get training videos and books, plus expert support: