Mobile browser detection¶
Go Mobile aims to strive to support every HTML capable phone on this planet, not just iPhone and other popular smartphones. Go Mobile users mobile.sniffer Python package to provide abstraction layer for handset detection over different handset databases.
- Choose your favorite handset database: DeviceAtlas, Wurfl or internal library.
- mobile.sniffer abstraction layer can source information from multiple databases, reaching potential of over 10000 known handset records.
- See what sites features are varied by the handset
- Free Wurfl database is shipped with the product so that handset detection works out-of-the-box
For more information, see mobile.sniffer Python package.
Enabling handset detection¶
Handset detection is enabled out of the box and you don't need to do anything special to use it. Wurlf database is supplied with the product.
See mobile.sniffer.wurlf package source code for details.
Two-phase handset detection¶
Handset detection and varying is done in two phases.
- Brand name recognizition algorithm is used to redirect web site visitors to mobile site. We do not directly rely on handset database here, as user agent string analysis would provide too many false positives otherwise. This is defined in mobile.sniffer.detect and gomobile.mobile.redirector packages.
- When the site is rendered in mobile mode, handset properties are read using mobile.sniffer package. Currently this is mainly utilized for screen width and height.
- Special heurestics rules can be applied by mobile.heurestics package and they
might or might not be tied to handset database.
- How to make phone numbers clickable
- Creating downloadedable vcards / phone numbers
- Opening the phone map / navigator
HTML and XHTML¶
Mobile site crawler robots (googlebot-mobile) are served content as XHTML instead HTML, since these user agents demand so. For all other handsets HTML is served as HTML 4.0 transitional, since the experience has proven this to be the most working solution.
This is detected separately from the handset detection using mobile.heurestics.contenttype package.
Testing different handsets¶
Use Firefox User Agent Switcher extension <https://addons.mozilla.org/en-US/firefox/addon/59> to see how your site (image dimensions) look for different user agents.
Useful user agents:
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16 Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95/11.0.026; Profile MIDP-2.0 Configuration/CLDC-1.1) AppleWebKit/413 (KHTML, like Gecko) Safari/413 Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/188.8.131.52.c.1.101 (GUI) MMP/2.0 (compatible; googlebot-mobile/2.1; +http://www.google.com/bot.html) Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 Nokia5800d-1/21.0.025; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413 Opera/9.60 (J2ME/MIDP; Opera Mini/4.2.13918/670; U; en) Presto/2.2.0
Changing handset database backend¶
This is a developer level task.
The used handset database is configured on Plone site layer level. To change it, you need to redefine IMobileUserAgentSniffer adapter for your site.
New Wurlf database is shipped with every Go Mobile release. If you manually want to update Wurlf, see mobile.sniffer package for necessary files and scripts.