Search in the Documentation:

Mobile Rendering

An alternative to the native application rendering is to use user agent matching to change the template type so that the rendering may adapt the size and navigation to the size of mobile devices. Jahia makes it possible to configure the user agent matching using regular expression matching and changing the template type dynamically so it becomes possible to switch to alternate scripts to render the content. For example, if we have the following configuration in the WEB-INF/etc/spring/application-renderer.xml file:

<bean class="org.jahia.services.render.filter.UserAgentFilter">
<property name="priority" value="6" />
<property name="applyOnModes" value="live,preview" />
<property name="applyOnConfigurations" value="page" />
<property name="userAgentMatchingRules">
<map>
<entry key=".*iPhone.*" value="iphone" />
<entry key=".*iPod.*" value="iphone" />
<entry key=".*iPad.*" value="iphone" />
<entry key=".*Android.*" value="iphone" />
</map>
</property>
</bean>

This means that if an iPhone or Android user agent is detected, it will first look for an “html-iphone” script directory for a view script, and if it does not exist, it will default to an “html” directory. As you can see this simple yet powerful mechanism makes it possible to do all kinds of user agent matching. You could even use it to render for specific desktop user agents (such as legacy ones).

It is also possible to use integrate with solutions such as the Apache Mobile Filter (http://www.idelfuschini.it/it/apache-mobile-filter-v2x.html) which can expose mobile device capabilities as request attributes if you need more precise control over page rendering. This might also be a good candidate for a filter, or you could integrate WURFL (http://wurfl.sourceforge.net/) as a module.