Class: Browser::Navigator
- Includes:
- Native
- Defined in:
- opal/browser/navigator.rb
Overview
Representation of the navigator application.
Defined Under Namespace
Classes: MimeType, Plugin, Plugins, Product, Vendor, Version
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
The browser code name.
-
#language ⇒ String
readonly
The browser language.
-
#mime_types ⇒ Native::Array<MimeType>
readonly
The supported MIME types.
-
#name ⇒ String
readonly
The browser name.
-
#operating_system ⇒ String
(also: #os)
readonly
The operating system the browser is running on.
-
#platform ⇒ String
readonly
The platform the browser is running on.
-
#plugins ⇒ Plugins
readonly
The enabled plugins.
-
#product ⇒ Product
readonly
The product name and version.
-
#user_agent ⇒ String
readonly
The browser's user agent.
-
#vendor ⇒ Vendor
readonly
The vendor name and version.
-
#version ⇒ Version
readonly
The browser version.
Instance Method Summary collapse
-
#java? ⇒ Boolean
Check if Java is enabled.
-
#offline? ⇒ Boolean
Check if the browser is in offline mode.
-
#track? ⇒ Boolean
Check if DNT is disabled.
Instance Attribute Details
#code ⇒ String (readonly)
Returns the browser code name.
88 |
# File 'opal/browser/navigator.rb', line 88 alias_native :code, :appCodeName |
#language ⇒ String (readonly)
Returns the browser language.
110 |
# File 'opal/browser/navigator.rb', line 110 alias_native :language |
#mime_types ⇒ Native::Array<MimeType> (readonly)
Returns the supported MIME types.
114 115 116 117 118 |
# File 'opal/browser/navigator.rb', line 114 def mime_types Native::Array.new `#@native.mimeTypes`, get: :item, named: :namedItem do |m| MimeType.new(m) end end |
#name ⇒ String (readonly)
Returns the browser name.
92 |
# File 'opal/browser/navigator.rb', line 92 alias_native :name, :appName |
#operating_system ⇒ String (readonly) Also known as: os
Returns the operating system the browser is running on.
127 |
# File 'opal/browser/navigator.rb', line 127 alias_native :operating_system, :oscpu |
#platform ⇒ String (readonly)
Returns the platform the browser is running on.
133 |
# File 'opal/browser/navigator.rb', line 133 alias_native :platform |
#plugins ⇒ Plugins (readonly)
Returns the enabled plugins.
137 138 139 |
# File 'opal/browser/navigator.rb', line 137 def plugins Plugins.new(`#@native.plugins`) end |
#product ⇒ Product (readonly)
Returns the product name and version.
143 144 145 |
# File 'opal/browser/navigator.rb', line 143 def product Product.new(`#@native.product`, `#@native.productSub`) end |
#user_agent ⇒ String (readonly)
Returns the browser's user agent.
149 |
# File 'opal/browser/navigator.rb', line 149 alias_native :user_agent, :userAgent |
Instance Method Details
#java? ⇒ Boolean
Check if Java is enabled.
158 159 160 161 162 |
# File 'opal/browser/navigator.rb', line 158 def java? `#@native.javaEnabled()` rescue false end |
#offline? ⇒ Boolean
Check if the browser is in offline mode.
121 122 123 |
# File 'opal/browser/navigator.rb', line 121 def offline? `!#@native.onLine` end |
#track? ⇒ Boolean
Check if DNT is disabled.
104 105 106 |
# File 'opal/browser/navigator.rb', line 104 def track? `!#@native.doNotTrack` end |