NAME
Plack::Middleware::DetectMobileBrowsers - Automatically set a flag in the environment if a mobile client is detected
VERSION
version 0.05
SYNOPSIS
  use Plack::Builder;
  my $app = sub { ... } # as usual
  builder {
      enable 'DetectMobileBrowsers';
	  # or: enable 'DetectMobileBrowsers', env_key => 'mobileDevice';
	  # or: enable 'DetectMobileBrowsers', tablets_as_mobile => 1;
      $app;
  };
  # ... and later ...
  
  if ( $yourApp->theEnv->{'mobile_client'} ) {
      # ... do something ...
  }
DESCRIPTION
This Plack middleware uses the regular expression provided by http://detectmobilebrowsers.com/ to analyse the User-Agent HTTP header and to set an environment flag to either a true or false value depending on the detection of a mobile client device.
The default name of the flag in the environment is mobile_client, but this can be customized by setting the env_key option when enabling this middleware.
It might make sense to use psgix.mobile_client by default instead, but the PSGI spec states that the "'psgix.' prefix is reserved for officially blessed extensions" - which does not apply to this module. You may, however, set the key to psgix.mobile_client yourself by using the env_key option mentioned before.
REGEX VERSION
2014-08-01
CONFIGURATION
You may specify the following option when enabling the middleware:
env_key- 
Set the name of the entry in the environment hash.
 tablets_as_mobile- 
Determines if tablets are considered to be mobile devices. By default they are not; set this param to a true value to change the default behaviour.
 
SEE ALSO
Plack, Plack::Middleware, http://detectmobilebrowsers.com/
AUTHOR
Heiko Jansen <hjansen@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Heiko Jansen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.