Class: Browser::InternetExplorer

Inherits:
Base
  • Object
show all
Defined in:
lib/browser/internet_explorer.rb

Direct Known Subclasses

Edge

Constant Summary collapse

TRIDENT_MAPPING =
{
  "4.0" => "8",
  "5.0" => "9",
  "6.0" => "10",
  "7.0" => "11",
  "8.0" => "12"
}.freeze

Instance Attribute Summary

Attributes inherited from Base

#accept_language, #ua

Instance Method Summary collapse

Methods inherited from Base

#alipay?, #bot, #bot?, #chrome?, #core_media?, #device, #edge?, #electron?, #facebook?, #firefox?, #ie?, #initialize, #known?, #meta, #micro_messenger?, #modern?, #nokia?, #opera?, #opera_mini?, #otter?, #phantom_js?, #platform, #proxy?, #quicktime?, #safari?, #safari_webapp_mode?, #to_s, #uc_browser?, #version, #webkit?, #webkit_full_version, #weibo?, #yandex?

Constructor Details

This class inherits a constructor from Browser::Base

Instance Method Details

#compatibility_view?Boolean

Detect if IE is running in compatibility mode.

Returns:

  • (Boolean)


40
41
42
# File 'lib/browser/internet_explorer.rb', line 40

def compatibility_view?
  trident_version && msie_version.to_i < (trident_version.to_i + 4)
end

#full_versionObject



22
23
24
# File 'lib/browser/internet_explorer.rb', line 22

def full_version
  "#{ie_version}.0"
end

#idObject



14
15
16
# File 'lib/browser/internet_explorer.rb', line 14

def id
  :ie
end

#match?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/browser/internet_explorer.rb', line 35

def match?
  msie? || modern_ie?
end

#msie_full_versionObject



26
27
28
29
# File 'lib/browser/internet_explorer.rb', line 26

def msie_full_version
  (ua.match(%r{MSIE ([\d.]+)|Trident/.*?; rv:([\d.]+)}) && ($1 || $2)) ||
    "0.0"
end

#msie_versionObject



31
32
33
# File 'lib/browser/internet_explorer.rb', line 31

def msie_version
  msie_full_version.split(".").first
end

#nameObject



18
19
20
# File 'lib/browser/internet_explorer.rb', line 18

def name
  "Internet Explorer"
end