wordpress mobile clickable phone number

Hi I am working ona client website 1234insurance.com and there is a graphic phone image in the header. The javascript uses the callto function. I just basically want the click to call functionality to work on as many phones as possible. How do people generally handle this?

When you click on it from a phone, it says: the web page at callto://310-473-2680 might be temporarily down or it may have moved permanently to a new web address.

    <!-- end of .call-to-action -->
    <!-- IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
        <script src="<?php echo get_template_directory_uri(); ?>/inc    /js/html5.js"     type="text/javascript"></script>
<![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">    </script>
<script>
    function isiPhone(){
        var agent = navigator.userAgent;
        var isIphone = ((agent.indexOf('iPhone') != -1) ||     (agent.indexOf('iPod') != -1)) ;
        if (isIphone) {
            return true;
        } else {
            return false;
        }
    }
    $(document).ready(function() { 
        $('a[href*="callto"]').each(function(){
         call_href = $(this).attr('href');
         if(isiPhone()){
            call_href = call_href.replace('callto://','tel:');
            $(this).attr('href',call_href);
         }
        });
    });
    /*

Related posts

Leave a Reply

1 comment

  1. I figured it out. The first thing is I didn’t create this site to begin with I get paid monthly by client to do updates. The graphic of the phone number was not accessible through wordpress to change the hyperlink. I had to download all the files and I found the file “header-hooks.php” In that file I could select the graphic and change it from callto to tel. I just don’t get why this wasn’t accessible in wordpress, but whatever. I am new to wordpress as well. Thanks for your help still Mark. That mobile browser redirect url code is pretty neat.