Created
March 27, 2012 14:28
Revisions
-
kinopyo created this gist
Mar 27, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ # from https://github.com/ruby-china/ruby-china/blob/master/app/helpers/application_helper.rb 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|iphone|mobileexplorer|mobile' def mobile? agent_str = request.user_agent.to_s.downcase return false if agent_str =~ /ipad/ agent_str =~ Regexp.new(MOBILE_USER_AGENTS) end