Front End

Using URL Scheme for Telephone Numbers in HTML

Posted on by  
Hubert Klein Ikkink

We can use the tel: URL scheme for phone numbers in HTML. Just like the mailto: URL scheme will open the default mail application will the tel: start a telephone call. If the HTML page is viewed on a mobile phone and we select a link with the tel: scheme we can immediately call the number following the scheme. On a desktop computer a VOIP call will be initiated.

We can use hyphens in the phone number for readability, they will be ignored when the call is made. For example the imaginary phone number 123456789 in the Netherlands can be used as shown in the following HTML snippet:

Continue reading →

JavaScript: console logging (with IE safety)

Posted on by  
Richard Rijnberk

Every once in a while I work on a site which has some or copious amounts of javascript. Now I do not mind this at all. But it's pretty tedious stuff writing the code and putting in loggers. And when you're working on something and you have to test it on IE. Well let's just say the console may cause some problems. But rather then removing all the logging i've found there's an easy solution. Building yourself a logger like structure which checks the existence of the console before writing. That way you can add logging statements without crashing the entire application. A sample logger would look like this:

logger={
    log: function(message) {
        if(window.console && console.log) console.log(message)
    },
    dir: function(message) {
        if(window.console && console.dir) console.dir(message)
    }
}

// We can call this like so:
logger.log($("head title").text());

// or so:
logger.dir($("body"));

Continue reading →

shadow-left