class Browser::InternetExplorer

Constants

TRIDENT_MAPPING

msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx#TriToken

Public Instance Methods

compatibility_view?() click to toggle source

Detect if IE is running in compatibility mode.

# File lib/browser/internet_explorer.rb, line 39
def compatibility_view?
  trident_version && msie_version.to_i < (trident_version.to_i + 4)
end
full_version() click to toggle source
# File lib/browser/internet_explorer.rb, line 21
def full_version
  "#{ie_version}.0"
end
id() click to toggle source
# File lib/browser/internet_explorer.rb, line 13
def id
  :ie
end
match?() click to toggle source
# File lib/browser/internet_explorer.rb, line 34
def match?
  msie? || modern_ie?
end
msie_full_version() click to toggle source
# File lib/browser/internet_explorer.rb, line 25
def msie_full_version
  (ua.match(%r{MSIE ([\d.]+)|Trident/.*?; rv:([\d.]+)}) && ($1 || $2)) ||
    "0.0"
end
msie_version() click to toggle source
# File lib/browser/internet_explorer.rb, line 30
def msie_version
  msie_full_version.split(".").first
end
name() click to toggle source
# File lib/browser/internet_explorer.rb, line 17
def name
  "Internet Explorer"
end

Private Instance Methods

ie_version() click to toggle source
# File lib/browser/internet_explorer.rb, line 45
def ie_version
  TRIDENT_MAPPING[trident_version] || msie_version
end
modern_ie?() click to toggle source
# File lib/browser/internet_explorer.rb, line 58
def modern_ie?
  ua =~ %r[Trident/.*?; rv:(.*?)]
end
msie?() click to toggle source
# File lib/browser/internet_explorer.rb, line 54
def msie?
  ua =~ /MSIE/ && ua !~ /Opera/
end
trident_version() click to toggle source

Return the trident version.

# File lib/browser/internet_explorer.rb, line 50
def trident_version
  ua.match(%r[Trident/([0-9.]+)]) && $1
end