The MobileKey module is an extension of the ThemeKey module that gives you a way to switch theme based on whether the user is viewing your website with mobile phone.
The installation is very simple. Follow the default Drupal 6.x installation steps (extract the tarball under your sites/all/modules/ folder.)
The module currently supports two features, a switch to force a mobile specific theme and a global redirect for your website front page.
Get the tarball or the zip file of the module from Drupal.org (MobileKey on Drupal).
Go to one of you module folders and extract the file you downloaded.
The default installation folder is sites/all/modules, if you have a multi-site installation and want the module for just a few sites, go to sites/<sitename>/modules instead (create the modules folder if it doesn't exist yet.) It is recommended that you do not install under the top modules folder as this one is reserved for Drupal Core modules.
At that point, go to your Drupal website and go to Administer » Site building » Modules. In the Mobile field set, select the MobileKey module and click Save.
Note that the ThemeKey module is required and must also be installed. If you cannot select the MobileKey module, that's because the ThemeKey module is not yet available in your installation. Otherwise, if the ThemeKey module was not yet installed, clicking on Save will first ask you whether you'd like to do so and then the installation will proceed with the ModuleKey module.
Now the module is installed. Note that it will have no effect until you apply settings as shown in this documentation.
The main idea of MobileKey is to give you the capability to switch your website theme to a mobile specific theme when the user access your site from one's mobile phone. A mobile theme will make it easier to access your website on a mobile device.
For go to the ThemeKey settings page:
Administer » Site configuration » ThemeKey
The MobileKey adds one selection to the list of attributes to match. The new selection is called:
mobile:device
This works everywhere on your website (it is a global option, not specific to any kind of pages.) The system checks different parameters to determine whether the user accessing your website is using a mobile phone. These parameters are:
HTTP_X_WAP_PROFILE HTTP_PROFILE HTTP_ACCEPT HTTP_USER_AGENT
Only mobile phones offer an HTTP Profile. The Accept parameter has two specific types that are viewed as mobile specific (text/vnd.wap.wml and application/vnd.wap.xhtml+xml).
And the User Agent is the name of the browser which is checked against well known mobile phones such as iPhone, Blackberry, iPod, Andriod, Opera Mini, Kindle, Symbian, and many others1.
The mobile:device value is a string. If the device is a desktop device, then "desktop" is returned. For mobile phones, different strings are returned depending on the type of mobile. Some are well known and can support specific themes!
The currently supported systems are2:
The "mobile" value is a fallback for all types of phones that are not well known phones such as iPhones.
For test purposes, we suggest that you use the "!" operator and "desktop" as the value. This means, any mobile whatsoever.
You can then add some sub-rules that check for specific phones and react differently for, say, an Android and Blackberry than any other mobile phone. The following picture shows you such a setup.
There are other settings that are specific to the MobileKey module. See the next chapter for more information.
The MobileKey module comes with the following settings. These settings are found here:
Administer » Site configuration » MobileKey
Since you generally give one URL to your users, your home page (called Front Page in Drupal), it can be practical to send Mobile phone users to a special URL so when they access your site they see a better adapted front page than the usual.
The settings accept a local path (i.e. mobile) or a full path (i.e. http://mobile.example.com/).
Note that this gives you a way to use the ThemeKey capability to change the theme of all the pages that match "mobile/%" or that are accessed using a different domain name.
Technical detail: the redirection uses code 303 (i.e. See Other.)
IMPORTANT
Note that if you make use of static caches, this feature will not work with the default web server set up.
The feature sets a COOKIE named mk_device that can be checked by Apache2 to bypass the static cache if necessary: when the front page is accessed and mk_device is not set at all or has a value other than 'desktop,' then don't return the cached front page.
The Boost module can be used to cache pages on your website. Unfortunately, if a page is cached, it is served without accessing Drupal. This means, the redirection offered by the MobileKey doesn't take effect on pages cached by Boost or similar modules.
Also if you have a form of proxy cache (a cache before Apache2,) then the redirection will probably be prevented by that cache early on.