Created
March 18, 2013 15:35
-
-
Save moudy/5188040 to your computer and use it in GitHub Desktop.
This file contains 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 characters
# Detect unsuppoerted browsers exculding crawlers and chrome frame | |
# browser gem - https://github.com/fnando/browser | |
def is_unsupported_browser? | |
is_ie = browser.ie6? || browser.ie7? || browser.ie8? | |
is_firefox36 = browser.firefox? && browser.full_version.match(/^3.6.*/) | |
is_crawler = request.env["HTTP_USER_AGENT"].match(/\(.*https?:\/\/.*\)/) if request.env["HTTP_USER_AGENT"] | |
has_chrome_frame = request.env["HTTP_USER_AGENT"].match(/chromeframe/) if request.env["HTTP_USER_AGENT"] | |
return !has_chrome_frame && (is_ie || is_firefox36) unless is_crawler | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment