Skip to content

Commit

Permalink
fixed benlangfeld#9 benlangfeld#11 removed mobile user agent and fixe…
Browse files Browse the repository at this point in the history
…d readme
  • Loading branch information
SentulAsia committed Feb 14, 2012
1 parent 411a492 commit 6e91e94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ set as :mobile format. It is up to you to determine how you want to handle
these requests. It is also up to you to create the .mobile.erb versions of
your views that are to be requested.

Then add the line below to config/initializers/mime_types.rb

Mime::Type.register_alias "text/html", :mobile
Mime::Type.register_alias "text/html", :tablet
Mobile Fu automatically adds a new `:mobile` and `:tablet` to `text/html` mime type
alias for Rails apps. If you already have a custom `:mobile` alias registered in
`config/initializers/mime_types.rb`, you can remove that.

I recommend that you setup a before_filter that will redirect to a specific page
depending on whether or not it is a mobile request. How can you check this?
Expand Down
11 changes: 1 addition & 10 deletions lib/mobile-fu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,9 @@ class Railtie < Rails::Railtie

module ActionController
module MobileFu
# These are various strings that can be found in mobile devices. Please feel free
# to add on to this list.
MOBILE_USER_AGENTS = 'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' +
'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' +
'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' +
'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' +
'webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|' +
'mobile'

# These are various strings that can be found in tablet devices. Please feel free
# to add on to this list.
TABLET_USER_AGENTS = 'ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle'
TABLET_USER_AGENTS = 'ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle|honeycomb'

def self.included(base)
base.extend ClassMethods
Expand Down

0 comments on commit 6e91e94

Please sign in to comment.