For a website I want to use specific CSS rules for mobile devices. What I want is the following:
- create a link on a phone number, and make it clickable for mobile devices
- code example:
<a href="tel:+1234567890">+1234567890</a>(similar to mailto:john@hotmail.com) - Clicking this link on a normal computer will probably produce an error message saying that they don’t know the tel-protocol.
I want to use CSS to hide the phone number with the link on non-mobile devices, and display another element with a plain phone number. I could use the media=”handheld” option, but it seems Android and iOS ignore this. A clean CSS-method is preferred, but it’s no problem if Javascript (or JQuery) is needed.
My question is now about this tel-link, but I probably will use the same method for other changes to the stylesheet for mobile devices.
This is what i use to check if the given request comes from a mobile device:
I made this with help of a mate of mine, if you have tips or corrections for me please give in comments:)