-
Notifications
You must be signed in to change notification settings - Fork 0
mod_amf
The mod_amf is a C version of AMFLiteDetection and is the fastest way to detect mobile devices.
mod_amf is suggested to use for solution that not need exactly the type of device, but only if the device is mobile, is a tablet or touch device. Is not require a Device Repository but only to access to our web services.
The modules does this three steps:
*load data additinal parameter from apachemobilefilter.org online service (isfree) *could be manage to force mobile device to full browser layout.
The first step is to define the AMFHome this is important for AMF because in this directory the AMF store all file .
In httpd.conf of Apache you define this parameter:
AMFHome /Users/idelfuschini/SVILUPPO_PLUGIN/apache2_dev/Apache2/AMF_Home AMFActivate on
where AMFHome must be writeable. For activate or deactivate AMF, the default value is "on".
At the start AMF download the files configuration from Apache Mobile Filter official site, if apache can't connect to the website, you can disable the download with AMFDownloadParam (default value if "on".
AMFHome /Users/idelfuschini/SVILUPPO_PLUGIN/apache2_dev/Apache2/AMF_Home AMFActivate on AMFDownloadParam off
If your server is behind a proxy set this configuration:
AMFHome /Users/idelfuschini/SVILUPPO_PLUGIN/apache2_dev/Apache2/AMF_Home AMFActivate on AMFDownloadParam off
To increase performance of AMF in production environment put the AMFProduction environment in this mode:
AMFProduction on
if you want to force some device (for example tablet) to be able to access to desktop version you can set the AMF+ with this configuration:
AMFHome /Users/idelfuschini/SVILUPPO_PLUGIN/apache2_dev/Apache2/AMF_Home AMFProxy http://10.6.222.1:3128 AMFProxyUsr lottomatica\e2326 AMFProxyPwd giaki!1998 AMFDownloadParam on AMFFullBrowser on AMFActivate on
NOTE: AMFProxy,AMFProxyUsr,AMFProxyPwd must be setted before AMFDownloadParam directive
If your apache is configured as worker is suggested to switch off AMFLog:
AMFLog off
With AMF Log directive it's possible to disable verbose mode default is on:
AMFLog off
In this mode in your site you can make a simple link like this:
Desktop Version
in this mode the AMF+ add the new environment variable FORCE_TO_DESKTOP setted with "true" value.
There are few but important info that AMF+ give as environment variable:
AMF_DEVICE_IS_MOBILE (true/false)
AMF_DEVICE_IS_TABLET (true/false)
AMF_DEVICE_IS_TOUCH (true/false)
AMF_DEVICE_MOBILE_OS (deprecated from 1.3.2)
AMF_DEVICE_MOBILE_OS_VERSION (deprecated from 1.3.2)
AMF_FORCE_TO_DESKTOP (true/false)
AMF_DEVICE_IS_TV (true/false)
AMF_DEVICE_IS_DESKTOP (true/false)
AMF_DEVICE_OS (from 1.3.2)
AMF_DEVICE_OS_VERSION (from 1.3.2)
AMF_BROWSER_TYPE (from 1.3.2)
AMF_BROWSER_VERSION (from 1.3.2)
AMF_CH_UA (from 1.5.0)
AMF_CH_UA_ARCH (from 1.5.0)
AMF_CH_UA_MODEL (from 1.5.0)
AMF_CH_UA_PLATFORM (from 1.4.0)
AMF_CH_UA_MOBILE (from 1.4.0)
Yes it's possible below a tipical example of how to use it:
RewriteCond %{ENV:AMF_DEVICE_IS_MOBILE} =true
RewriteCond %{ENV:AMF_DEVICE_IS_TABLET} =false
RewriteCond %{ENV:AMF_FORCE_TO_DESKTOP} !=true
RewriteRule (.*) "https://mobile.site.com" [R=301,L,NE]
in this case you redirect all mobile devices except tablet, and also you can manage the case if some mobile user want to see the desktop version of your site.
AMFHome
AMFActivate
AMFLog
AMFFullBrowser
AMFFullBrowserAccessKey
AMFDownloadParam
AMFmobile
AMFtouch
AMFtablet
AMFtv
AMFProxy
AMFProxyUsr
AMFProduction
AMFProxyPwd
Retrieve the AMF capabilities value is very simple, all the informations are setting into the Apache Environment as AMF_ for example:
To read the DetectRight capabilities AMF_IS_MOBILE you must read the environment value AMF_MAX_IMAGE_HEIGHT.
'''How to read environment in PHP ?''[[File:php.jpg]]
The php code is:
$_SERVER['AMF_DEVICE_IS_MOBILE'];
a test page in php is downloadable:
'''How to read the value in JSP (for Tomcat)?''' File:Tomcat.jpg
Before in the httpd.conf file where you have to configure mod_jk you muse add this:
JkEnvVar AMF_DEVICE_IS_MOBILE undefined
The Java code is:
request.getAttribute("AMF_DEVICE_IS_MOBILE")
'''How to read the value in PERL?''' File:Cpan2.png
print $ENV('AMF_DEVICE_IS_MOBILE');