Luca Passani
by Luca Passani
(email: name.surname@gmail.com)

 

The Switcher
(Ideal for m.*.com and *.mobi* domains and for re-directing iPhone's users to the mobile version of your site)

Last Update: April 13 2008

Important Note: The Switcher does NOT rely on WURFL

Welcome to the Switcher page.

In a nutshell, the Switcher is a Java application (PHP and dotNet ports are also available) that enables webmasters to detect whether an HTTP request has been originated by a mobile device or by a desktop web browser.
The obvious application for the switcher is to make the application manage all HTTP requests which hit a given URL defined by the webmaster. If the request comes from a mobile device, the browser is directed to a mobile version of the site, otherwise a fully-fledged web site is provided.

Let's assume you have a .mobi site and a regular .com site, and your organizations wishes to publish a unique URL for all possible HTTP clients, while redirecting each client to one of the two URLs automatically. For purely explicative purposes, we take www.vodafone.com and vodafone.mobi (*) as live examples of such two sites. You can set up the Switcher to recognize the nature of the requesting client and direct it to the appropriate site, as shown in the following picture:

Switcher in action

The Switcher is designed with the following requirements in mind:

  • Recognize everything mobile
  • Performance: handle thousands** of requests per minute.
  • Offer a reasonable degree of 'configurability' to address common needs.
  • Be as much as possible 'future-proof': avoid the need to update the switcher constantly (updates and bug-fixes will be made available)
  • Do not rely on third-party libraries (Logging is used, but easily removable).
  • Do not rely on WURFL (It would require managing the Switcher on a weekly (or, at least, monthly) basis)

** actual performance depends on choice of hardware/application server

While several scripts have been made available on web sites and developer forums to recognize mobile devices (and while many of those effectively do the job for the some common browsers and minibrowsers), no publicly available application is able to cover all the cases covered by the Switcher. The Switcher, in fact, relies on the knowledge acquired over the years by Luca Passani, in projects on both sides of the Atlantic.

Luca is internationally known in the industry for his work with mobile services and for his support to the community of mobile developers through WMLProgramming at Yahoo Groups. In addition, Luca is the creator of WURFL and WALL, popular software tools which build on his experience analyzing mobile devices and microbrowsers from around the planet. Lately, Luca has been involved with W3C Mobile activities, even though his disagreement with the W3C Best Practices has led him to create an alternative set of guidelines for the mobile web, which happen to be an excellent introduction to the creation of .mobi compliant sites.

Mobile Microbrowsers

Whenever an HTTP request is received, the Switcher will analyze each and every header looking for an answer to a simple question "Is this a mobile device or not?".
Once the question is answered, the Switcher will direct the requesting client to the URL that's most appropriate for it (and please observe that understanding how to redirect and arbitrary microbrowser is not very simple either!).

Finally, the Switcher has been tested on a variety of networks (such as: Sprint-Nextel, Verizon, Cingular (US), O2, Vodafone (UK), H3G, Vodafone, Tim (IT), KPN (iMode, Holland), Telefonica (Spain), TMN (Portugal), T-Mobile, Vodafone (Germany), DoCoMo, KDDI (Japan), Telstra (Australia)), devices (newer and older BlackBerry, Nokias, Motorolas, LG, SonyEricsson, Sharp, Siemens-Benq, Nec, Samsung, iMate, Qtek) and microbrowsers (Openwave, Nokia, Safari, Opera, Opera Mini Access Netfront, Teleca/Obigo, RIM).
In addition to the devices above, tests were conducted on exotic mobile clients, such as Portable PlayStation (PSP), Danger HipTop and Nintendo DS.

The Switcher also detects the Apple's iPhone as a mobile device. This makes the Switcher an ideal solution for all of those sites that observe high traffic from iPhone users and wish to direct those users to a better mobile browsing experience.

Web Browsers

In addition to microbrowsers, the Switcher will recognize the great majority of web browsers (new and old).

What is a mobile browser and what is not?

Some may argue that there are several borderline cases for which it is not easy to say whether the mobile browser should be considered a fully fledged web browser or not. The Switcher does not have such doubts:

  • If a request comes from a PC (Mac, Windows, Linux, OS/2, BeOS) featuring a big screen, a mouse and a full QUERTY keyboard you can type on with two hands, then it is a web browser.
  • If a requets comes from a device that does not have those features, then it's a mobile device: different user-experience, different usage patterns, different business model.
  • There's one third possibility: Bots, Crawlers and indexers. The switcher recognizes the most popular (and a bunch of less popular ones) and can be configured to treat them specially.

Why .mobi (dotMobi)

Over the past few months, a company called .mobi has created the possibility for any company to register their respective .mobi domains. The idea is that companies can create a mobile version of their websites and make them available with an http://mycompany.mobi domain. In case .mobi domains become the norm, consumers won't need to go look for the URL of a mobile site (which would basically kill the whole idea of having a mobile site). Instead, people will just need to enter 'mycompany.mobi' in their mobile browser and off they go: the right site is displayed right there on their devices.
The possibility that dotMobi will actually take off is not so remote, since dotMobi appears to be backed by huge industry players such as Vodafone, Nokia, Ericsson, Microsoft, Tim, Telefonica and I am just naming a few.

In addition to the .mobi domain, a popular choice for companies these days is to use the 'm.company.com' address for their mobile sites. This is at least equally recognizable by mobile users as .mobi domain, it does not require that a company/organization acquires a new domain and reinforces the 'Internet brand' of the organization.
Of course, the Switcher is perfectly applicable to redirect users to www.company.com or m.company.com depending on whether they are using a mobile device or not.

At this point, you may wonder what all of this has to do with the Switcher. This is easily explained

What's the need for a .mobi/m.* Switcher

If you are planning to launch a mobile site for mobile users, there are different scenarios in which the Switcher will play an important role in your web strategy.
Assuming the following holds generally true:

  • you don't want mobile clients to access your website and deliver a poor user experience to users.
  • you don't want desktop web clients to access your .mobi (or mobile) miniaturized site.

there are two cases:
You maintain one single URL for both mobile and web sites: In this case, the Switcher is exactly what you need to rout each client to the site that's best for it.

You maintain two URLs (typically www.yourcompany.com and yourcompany.mobi, but it could be anything) and you want to make sure that no client gets a different version than the one you meant for them: also in this case, the switcher is exactly what you need. Install one switcher per virtual server, and make sure that no browser is admitted to the party where it is not welcome.

As a little aside, you may wonder what it takes to create a dotMobi site.
This is in fact virtually the same as "acquiring a dotMobi" domain (which you can do for a bunch of dollars directly online, just google for ".mobi" and look at the ads) and building a mobile site.
To be totally honest, the dotMobi guys also require that you build the site according to the guidelines that they created together with W3C.
For reasons the explanation of which goes beyond the scope of this document, not everything contained in the W3C practices is good practice. If you are serious about dotMobi, we recommend that you use the Global Authoring Practices for the Mobile Web instead.
Not only does GAP make more sense than W3C BP, but GAP templates also score 5 out of 5 with the .mobi Mobile Ready on-line checker!

How does the Switcher work?

The Switcher is a Java servlet (PHP and .net versions also vailable) that sits nicely at whatever URL you need to position it too. Of course, it usually makes sense to place it at the root of a web server (such as www.yourcompany.com) in order to trap each and every request coming from the outside and routing it to one of two different URLs.
The servlet is general purpose and does not require to be recompiled to carry out its tasks. All you need is to configure the servlet through its web.xml file.
The Switcher can be configured through the following parameters:

urlweb: no default. Must be absolute URL.
URL of the 'non-mobile' website
urlmobile: no default. Must be absolute URL.
URL of the mobile website
bot_redirect: default web
There are BOTs and Spiders indexing the web at all times out there. The Switcher lets you decide how you want those 'clients' to be managed: 'web','mobile' or an URL of your choice.
Because of the special nature of the utility, the Mobile OK DDC user-agent is treated as a mobile device (and is not recognized as a bot).
dot_mobi_redirect: default false
.Mobi style guide mandates that redirects are achieved through HTTP 302 responses. This will not guarantee maximum compatibility with all devices out there. Switcher default configuration will go for maximum compatibility, while leaving it up to the webmaster to comply with dotMobi style guides if required.
default_behavior: default 'web'. (other possible value, mobile)
In the unlikely event that a browser is not recognized, the Switcher will direct the client to the web URL. This behavior can be overridden with this directive.
extra_mobile_ua: default empty.
Once the Switcher has taken a decision about the nature of the requesting client (web or mobile), webmaster are given a chance to override the Switcher decision by matching the user-agent against a specific sub-string. This directive can be used for directing bare-bones web browser (such as Lynx) to the mobile URL.
extra_web_ua: default empty.
Once the Switcher has taken a decision about the nature of the requesting client (web or mobile), webmasters are given a chance to override the Switcher decision by matching the user-agent against a specific sub-string. This directive can be used for directing fully-fledged web browsers running on a mobile device (such as Opera, Safari or Portable PlayStation) to the web URL.

How to Purchase the Switcher

The Switcher is neither free software nor open-source. It is being sold for a fee by Luca Passani.
The Switcher is available as a Java servlet, .Net (C#) or PHP-program:

Java Source: 500 Euros.
The Servlet is provided with full source code.
PHP Source: 500 Euros.
PHP-program with full source code.
C#(.Net) Source: 500 Euros.
C# with full source code.

The license allows those who acquired the Switcher to use it on three pairs of domains (where a pair are two URLs representing the web and the mobile sites respectively).

Since providing a fully-fledged evaluation version of the product would nullify the possibilities of selling the actual servlet, I provide two things:

  • The URL pointing to an actual switcher
    By pointing your web-browser and/or mobile device to http://mtv.wurflpro.com/dj/ you will be able to see the switcher in action: mobile devices will be redirected to http://vodafone.mobi, while web browsers will be directed to http://www.vodafone.com.
    Note for Developers: If you are a developer using FireFox, be aware that some Firefox WML Plugins will change the accept header in each of your HTTP requests. This won't fool the Switcher, but it might get the Vodafone site to deliver WML instead of HTML.
  • A functionally crippled version of the switcher
    You can download and install this crippled version of the switcher version now. Keep in mind that most of the logic to identify and redirect mobile devices has been removed. Configuration is left the same through web.xml, though. In other words, if you decide to acquire the real Switcher, you can go on and install this version in the meanwhile: final installation will only be a matter of dropping the actual CLASS/JAR file into the right place once you receive it.
    To run the demo switcher on Tomcat, just download the swdemo.zip file into the webapps directory and restart tomcat. At that point, the demo switcher should be listening at:
    http://localhost:8080/swdemo/dj
I can invoice companies and individuals for the Switcher. My tax advisor tells me that I am not required to charge 20% VAT for selling the Switcher for either EU or non-EU companies.

If you are interested in purchasing the Switcher, feel free to contact me at my usual email address (luca dot passani at gmail dot com).

Switcher FAQ

Some questions and answers about the switcher:

Does the Switcher only work for .mobi sites?
Not at all. The switcher can be used to route any request from mobile devices to any URL, be it .mobi, m.*, wap.*, mobile.* or anything else.
Companies that create .mobi sites may decide to have a single URL for both their mobile and web sites. In those cases, the Switcher is a great way to route HTTP requests directed at the unique URL towards the most appropriate site.

Does the Switcher rely on WURFL?
No, it doesn't. The Switcher is designed to have no dependencies on third party libraries, WURFL included. Also, depending on WURFL would imply that web masters are required to update their WURFL repository sort of regularly, which most may not want to do.
Of course, WURFL provides more features than the Switcher to optimize and adapt for mobile content once the redirect to a mobile or dotMobi site has taken place.

Does the Switcher rely on third-party libraries?
Short answer: No
Longer answer: the Switcher relies on log4j for logging, but such a dependency can easily be removed.

Why isn't the switcher Open-Source as WURFL and the GAP templates?
I (Luca Passani) released a bunch of software/documentation as open source in the past. The result has been that people don't pay a dime, but they want more and more in terms of features and support.
While it is not my intention to change what has been made with WURFL, WALL and GAP, I think the time has come to 'balance' all that effort and see if people can put their money where their mouth is.
For the record, the trigger that made me decide that it was time to go 'commercial' to some extent was a very stupid remark on this blog in which WURFL is described as a joke idea created to make money (!).

Is there a PHP version of the Switcher?
Yes, there is. Price is the same as Switcher Source Code Version. (and yes, I know that there are PHP obfuscators around).

Is there a .Net/C# version of the Switcher?
Yes, there is. Price is the same as Switcher Source Code Version.

How does the Switcher handle reformatting transcoders?
Excellent question!
Reformatting transcoders (such as Novarra Vision, InfoGin IMP, Openwave's OpenWeb and others) represent a new and potentially dangerous trend for the mobile web, because of the attempt by network operators to modify HTTP requests without the consent of content owners.
Leaving discussions about how to handle the general transcoding situation aside, the Switcher will try to detect transcoders and redirect users to the mobile version of your content. The rationale is that a request going through the proxy must necessarily be coming from a mobile device and, as such, it should be directed to the mobile version of the content.
To add to that, webmasters who want to install the Switcher, are typically very concious of the need to deal with web and mobile visitors separately. Those webmasters will likely find operators' attempts to overcome their site organization annoying to say the least.
Unfortunately, transcoders may be reconfigured dynamically and they can inpersonate web browsers very closely by removing any hints that the request comes from a mobile device (including removal of the original UA string). Because of this, the Switcher cannot guarantee that transcoders which do not respect their typical (and known) configuration are recognised.
If you acquire the Switcher and have issues with a particular operator/transcoder, I will assist you in analysing the problem and dealing with it according to your particular needs.

How many domains can a paying developer use the Switcher on?
Three pairs. For example: (www.site1.com/site1.mobi), (www.site2.com/site2.mobi) and (www.site3.com/site3.mobi).


What if I want an unrestricted license for all the domains?
Contact me and we can talk about it. I am sure we can find a deal.

Will I be able to download the servlet as soon as I pay?
No, you won't. I will need to make sure that the money has come in and then I will mail you the package. This will happen within 48 hours, but very often in a matter of hours.

What kind of support will I get if I pay?
I will be more than pleased to help (via email) registered users of the Switcher with problems they may have while deploying the Switcher itself the first time. Of course, I will also address bugs which users may discovere as rapidly as possible (this usually happens with the introduction on the market of new devices which break with established conventions). Bug fixes will be communicated to registered users.

What if I find a mobile device that is not recognized?
In the unlikely event that you find a mobile device that is not recognized, please let me know ASAP: I will fix the problem and send you a newer version of the switcher that fixes the problem.

I have paid for the Switcher and I now see a newer version on the site. Am I entitled to a free upgrade?
You are entitled to free bug fixes. Major upgrades may require you to pay extra fees. This will be decided when upgrades will be made available (basically, if upgrade means bug fixes, I'll send it for free to registered users. If upgrade means a new brilliant idea which costed me time to implement, then I may require a fee for it also for registered users.).

If I acquire the Java Source version of the Switcher, will I have the right to re-sell or re-distribute it?
No, you won't! I retain the rights to the software. If you want to include a compiled version of the Switcher in the software you sell or distribute, please take contact with me to find an agreement.
If you want to distribute the source code, you can contact me as well, but that's going to be more expensive than redistributing the binary.

I have paid for the [Java | PHP | dotNet] version of the Switcher, and I now realize that I also need the [Java | PHP | dotNet] version. Will I need to pay a full license again?
No, you won't. I may send you the version in a different language for 100 Euros.
If you have acquired a site license of the Switcher, versions in other languages are free. Just drop me an email and request them.
Please consider that, if you have acquired a license previously, you already have the source-code of the Switcher. This means that a moderately experienced developer will be able to do the port for you, without you needing to pay 100 Euros. Please note that the 3 site limitation in the license still applies

I would like to buy a license for the Switcher, but I think it is too expensive. Can I have a discount?
Maybe. Drop me an email and explain what you want to do and why you think the switcher is expensive. I may grant you a discount.
While the Switcher is not exactly rocket science technology-wise, it distills from years of experience in the field, which means that developing it in-house would probably cost you more just to get a sub-optimal solution (i.e. one that fails on some device/browser/gateway combination).

Testimonials

Here is what people who have installed the Switcher have to say:

"Thanks to The Switcher, we are able to market two websites seamlessly under one domain name. We were skeptical at first, but after implementing the Switcher for over a year now, we are yet to find a mobile device in the U.S that does not work with the code.

And, to add to this code, Luca provided superb customer service, providing step-by-step direction on setting up the code.

Also, props to The Switcher, we have saved significant amount of money by advertising one domain name for both our .mobi and .com sites. We, at the Law firm of Elk & Elk, look forward to doing future business with Luca.

We believe The Switcher should be implemented on every commercial and personal website - it is just so functional and cool."


Rohan Ghosh,
Ohio's Premier Medical Malpractice & Personal Injury Law Firm,
Elk & Elk Co. Ltd.
Ohio, USA. http://www.elkandelk.com

(*) .mobi and Vodafone are the registered trademarks of the respective companies.

Copyright © 2002-2007, Luca Passani