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

#ua

Instance Method Summary collapse

Methods inherited from Base

#accept_language, #alipay?, #bot, #bot?, #chrome?, #chromium_based?, #core_media?, #device, #duck_duck_go?, #edge?, #electron?, #facebook?, #firefox?, #google_search_app?, #huawei_browser?, #ie?, #initialize, #instagram?, #known?, #maxthon?, #meta, #micro_messenger?, #miui_browser?, #nokia?, #opera?, #opera_mini?, #otter?, #phantom_js?, #platform, #proxy?, #qq?, #quicktime?, #safari?, #safari_webapp_mode?, #samsung_browser?, #snapchat?, #sougou_browser?, #sputnik?, #to_s, #uc_browser?, #unknown?, #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)


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

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)


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

def match?
  msie? || modern_ie?
end

#msie_full_versionObject



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

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

#msie_versionObject



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

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