Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6047035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:18:26+00:00 2026-05-23T07:18:26+00:00

For a website I want to use specific CSS rules for mobile devices. What

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:18:26+00:00Added an answer on May 23, 2026 at 7:18 am

    This is what i use to check if the given request comes from a mobile device:

    $mobile_browser = '0';
    
    if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
        $mobile_browser++;
    }
    
    if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) {
        $mobile_browser++;
    }    
    
    $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));
    $mobile_agents = array(
        'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
        'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
        'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
        'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
        'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
        'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
        'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
        'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
        'wapr','webc','winw','winw','xda ','xda-');
    
    if (in_array($mobile_ua,$mobile_agents)) {
        $mobile_browser++;
    }
    
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows') > 0) {
        $mobile_browser = 0;
    }
    
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'mac') > 0) {
            $mobile_browser = 0;
    }
    
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'ios') > 0) {
            $mobile_browser = 1;
    }
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'android') > 0) {
            $mobile_browser = 1;
    }
    
    if($mobile_browser == 0)
    {
        //its not a mobile browser
        echo"You are not a mobile browser";
    } else {
        //its a mobile browser
        echo"You are a mobile browser!";
    }
    ?>
    

    I made this with help of a mate of mine, if you have tips or corrections for me please give in comments:)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use templavoila on an existing website. So i have to link
I want to use the following code to login to a website which returns
I want to use this pure HTML/CSS template for my ASP.NET website: http://sub3.tanguay.de I
I would like to create an XML-based website. I want to use XML files
i want use some data from a website with web service. i have a
I want to use the ajax dll 3.5 in the website of framework 2.0
I want to use the Saxon-B XQuery class in my ASP.Net website. But my
I have around 40 aspx pages in my website. I want to use a
I am building a news app for my website. I want to use a
I want to keep my website/s in version control (Subversion specifically) and use svn

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.