3

Before you ignore this post, I've read countless posts on how to use screen resolution, user agents, and the like to detect mobile platform as whether to display a "full featured" or larger website vs. a smaller one.

I am using .Net MVC4 and can already redirect to my .mobile pages via global.asax.cs and _Layout.Mobile files without a hitch.

My question is thus: Once on a mobile page, I'd like to know whether this is a phone of tablet (iPad, Android, etc) in order to render a "Call Us" button on the page. I am using jQueryMobile so I've got the code so far to do the following:

<a href="tel:+15559876543" data-role="button">Call Us Today</a>

Basically I am checking to see if the device has a radio and can make calls, so as not to frustrate that WiFi-only iPad user who clicks on a "Call Us" link and doesn't get anywhere.

I am entirely cognizant of the fact that there may be a better approach to what I am doing, and I am gratefully open to those suggestions as well.

Thanks in advance, Dan

djmarquette
  • 712
  • 8
  • 17
  • http://stackoverflow.com/questions/5341637/how-do-detect-android-tablets-in-general-useragent there doesn't seem to be a perfect strategy for this. a best-effort attempt is probably your best bet – mfsiega Oct 20 '12 at 19:55
  • Use javascript thats enough... – suresh gopal Oct 20 '12 at 20:08
  • suresh - Yes, javascript is definitely an option. The question is how to decide whether the device can make calls. Screen resolution is a moving target on newer platforms and it is harder to tell a tablet from a phone from Request.Browser.ScreenPixels... Or is there some snippet of Javascript you are referring to that I am unaware of? - Dan – djmarquette Oct 21 '12 at 17:17

1 Answers1

0

Replace the "call us today" text with the phone number. (IMO) this makes it a lot more obvious what the button would do if I clicked it, allows me to click it on my iPad if I want to add it to my contacts, or pickup the phone next to me and ring it as I can actually see the number.

Betty
  • 9,109
  • 2
  • 34
  • 48
  • The text actually says Call "Company Name", so I think the purpose of the button is intuitive enough. I am concerned, and researching having the phone # in plain text so as not to get skimmed by bots. Or is this not an issue anymore? Anyhow, that is a thought for another thread. – djmarquette Oct 21 '12 at 17:14