class UserAgent::Browsers::InternetExplorer

Constants

TRIDENT_ENGINES

Public Class Methods

extend?(agent) click to toggle source
# File lib/user_agent/browsers/internet_explorer.rb, line 12
def self.extend?(agent)
  agent.application &&
  agent.application.comment &&
  (agent.application.comment[1] =~ /MSIE/ ||
   agent.application.comment.join('; ') =~ /Trident.+rv:/)
end

Public Instance Methods

browser() click to toggle source
# File lib/user_agent/browsers/internet_explorer.rb, line 19
def browser
  "Internet Explorer"
end
chromeframe() click to toggle source

Before version 4.0, Chrome Frame declared itself (unversioned) in a comment; as of 4.0 it can declare itself versioned in a comment or as a separate product with a version

# File lib/user_agent/browsers/internet_explorer.rb, line 46
def chromeframe
  cf = application.comment.include?("chromeframe") || detect_product("chromeframe")
  return cf if cf
  cf_comment = application.comment.detect { |c| c['chromeframe/'] }
  cf_comment ? UserAgent.new(*cf_comment.split('/', 2)) : nil
end
compatibility_view?() click to toggle source
# File lib/user_agent/browsers/internet_explorer.rb, line 39
def compatibility_view?
  trident_version && version < real_version
end
os() click to toggle source
# File lib/user_agent/browsers/internet_explorer.rb, line 57
def os
  OperatingSystems.normalize_os(application.comment.join('; ').match(/Windows NT [\d\.]+|Windows Phone (OS )?[\d\.]+/).to_s)
end
platform() click to toggle source
# File lib/user_agent/browsers/internet_explorer.rb, line 53
def platform
  "Windows"
end
real_version() click to toggle source
# File lib/user_agent/browsers/internet_explorer.rb, line 35
def real_version
  [trident_version, version].sort.last
end
trident_version() click to toggle source
# File lib/user_agent/browsers/internet_explorer.rb, line 28
def trident_version
  if trident = application.comment.detect { |c| c['Trident/'] }
    trident_version = TRIDENT_ENGINES.fetch(trident, trident)
    Version.new(trident_version)
  end
end
version() click to toggle source
# File lib/user_agent/browsers/internet_explorer.rb, line 23
def version
  str = application.comment.join('; ')[/(MSIE\s|rv:)([\d\.]+)/, 2]
  Version.new(str)
end