Sha256: fc85310763a81c74c52b92439230185c99732e6d7d7e28d9a76cb6f252d70db1

Contents?: true

Size: 943 Bytes

Versions: 2

Compression:

Stored size: 943 Bytes

Contents

DetectMobiles
=============

!!! Also detects iPhone and iPod Touch, now !!!

This plugin provides an instance method to ActionController::Base which 
can be used as a before_filter. The filter scans the request for 
indication of a mobile browser or an iPhone/iPod and then sets 
request.format to either :mobile or :iphone. This can be used in the 
responds_to block and in the views.

Usage Example
=============
* install the gem
* add the MIME types to config/initializers/mime_types.rb
Mime::Type.register_alias "text/html", :iphone
Mime::Type.register_alias "text/html", :mobile
* add the gem to your config/environment.rb
->  config.gem "detect_mobiles"
* add the before_filter to your controller

class ApplicationController < ActionController::Base
  before_filter :detect_mobiles
end

now, the request.format will be changed to :mobile/:iphone depending on 
the browser. 


Copyright (c) 2008 Alex P, released under the MIT license

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aaalex-detect_mobiles-0.0.4 README
aaalex-detect_mobiles-0.0.5 README