Module: UserAgent::Browsers::InternetExplorer

Defined in:
lib/user_agent/browsers/internet_explorer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extend?(agent) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
# File 'lib/user_agent/browsers/internet_explorer.rb', line 4

def self.extend?(agent)
  agent.application &&
    agent.application.comment &&
    agent.application.comment[0] == "compatible" &&
    agent.application.comment[1] =~ /MSIE/
end

Instance Method Details

#browserObject



11
12
13
# File 'lib/user_agent/browsers/internet_explorer.rb', line 11

def browser
  "Internet Explorer"
end

#chromeframeObject

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



34
35
36
37
38
39
# File 'lib/user_agent/browsers/internet_explorer.rb', line 34

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

#compatibilityObject



19
20
21
# File 'lib/user_agent/browsers/internet_explorer.rb', line 19

def compatibility
  application.comment[0]
end

#compatibility_view?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/user_agent/browsers/internet_explorer.rb', line 27

def compatibility_view?
  version == "7.0" && application.comment.detect { |c| c['Trident/'] }
end

#compatible?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/user_agent/browsers/internet_explorer.rb', line 23

def compatible?
  compatibility == "compatible"
end

#osObject



45
46
47
# File 'lib/user_agent/browsers/internet_explorer.rb', line 45

def os
  OperatingSystems.normalize_os(application.comment[2])
end

#platformObject



41
42
43
# File 'lib/user_agent/browsers/internet_explorer.rb', line 41

def platform
  "Windows"
end

#versionObject



15
16
17
# File 'lib/user_agent/browsers/internet_explorer.rb', line 15

def version
  Version.new(application.comment[1].sub("MSIE ", ""))
end