-
Notifications
You must be signed in to change notification settings - Fork 14
/
README
executable file
·68 lines (43 loc) · 1.7 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
ActiveDevice : Open Mobile Device Detector
============
Mobile and Devices User Agent Detector, For Mobile Handsets, Devices and Desktop Browsers.
For Detect the Mobile and Recognize its Brand, Model, Engine, OS and Browser.
Installation
============
Install the gem from gemcutter:
sudo gem install active_device
You can also install this as a plugin:
script/plugin install git://github.com/shenoudab/active_device.git
Usage
=======
Add this one line to your Application controller.
class ApplicationController < ActionController::Base
include ActiveDevice
end
Once this is in place, any request that comes from a mobile device will be be
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
For Skiping setting the Format to :mobile
Add this line to your Application Controller
skip_before_filter :set_mobile_format
Example
=======
Examples from ActiveDevice Helper Methods.
is_mobile_device? : Checking if the Request from Mobile Device
is_mobile_browser?
is_bot?
is_device? 'iphone'
is_brand? 'Nokia'
is_model? 'NokiaE72'
device_model : Return the Device Model if Mobile.
device_brand : Return the Device Brand if Mobile.
agent_engine : Reurn the Useragnet Engine.
agent_os : Return Useragent Device OS.
Feedback
========
Send Feedback and questions to: sbertel at mobithought.com
More will Coming Soon, Wait for MobiThought
Copyright (c) 2009 Shenouda Bertel, MobiThought, released under the MIT license