Browser object

In AskiaScript, the browser object is a predefined object that can be used to obtain information about the current respondent's browser identity, resolution and capabilities. This variable is in the global scope, so is available everywhere inside AskiaScript.

Note: All detections are done through JavaScript. If JavaScript is disabled, all values fall back to defaults (false, "" or 0).

In this topic:

 

Properties

Mobile

Indicates whether the browser is running on a mobile device.

Returns a Boolean.

Example
Browser.Mobile ' => true

↑ Top of page ↑

Name

Returns the name of the browser.

Returns a String.

Examples
Browser.Name ' => "Internet Explorer"
Browser.Name ' => "Firefox"
Browser.Name ' => "Chrome"
Browser.Name ' => "" ' When unknown

↑ Top of page ↑

OS

Extended in version 5.4.6 to return other operating systems (e.g. iOS and Android) where appropriate.

Returns the short name of the operating system.

Returns a String.

Examples
Browser.OS ' => "Windows"
Browser.OS ' => "Mac"

Browser.OS ' => "" ' When unknown

↑ Top of page ↑

ScreenAvailHeight

Returns the available height, in pixels, of the rendering surface of the output device.

Source from w3c

Returns a Number.

Example
Browser.ScreenAvailHeight ' => 1040

 

↑ Top of page ↑

ScreenAvailWidth

Returns the available width, in pixels, of the rendering surface of the output device.

Source from w3c

Returns a Number.

Example
Browser.ScreenAvailWidth ' => 1920

 

↑ Top of page ↑

ScreenColorDepth

Returns the number of bits allocated to colours (i.e. excluding the alpha channel) in the output device. If the output device does not support colours, then these attributes must return zero.

Source from w3c

Returns a Number.

Example
Browser.ScreenColorDepth ' => 32

↑ Top of page ↑

ScreenHeight

Returns the height, in pixels, of the output device.

Source from w3c

Returns a Number.

Example
Browser.ScreenHeight ' => 1080

↑ Top of page ↑

ScreenWidth

Returns the width, in pixels, of the output device.

Source from w3c

Returns a Number.

Example
Browser.ScreenWidth ' => 1920

↑ Top of page ↑

UserAgent

Returns the user-agent of the browser.

Returns a String.

Example
Browser.UserAgent  ' => "Mozilla/5.0 (iPad; U;CPU OS 3_2_1 like Mac OS X; en-us)[...]" 
' for Safari on iPad

 

↑ Top of page ↑

Version

Available from version 5.3.5

Returns the major version number of the browser.

Returns a String.

Examples
Browser.Version ' => "8"
Browser.Version ' => "11.6"
Browser.Version.ToNumber() ' => 11.6
Browser.Version ' => "" ' When unknown

↑ Top of page ↑

WindowHeight

Returns the viewport height, in pixels, including the size of any rendered scroll bar (window.innerHeight).

Source from w3c

Returns a Number.

Example
Browser.WindowHeight' => 895

↑ Top of page ↑

WindowWidth

Returns the viewport width, in pixels, including the size of any rendered scroll bar (window.innerWidth).

Source from w3c

Returns a Number.

Example
Browser.WindowWidth' => 1916

↑ Top of page ↑

Methods

PluginVersion(key)

Returns the version of the specified plugin.

Parameter

Returns a String.

Examples
Browser.PluginVersion("Flash") ' => "11.2.202.235"
Browser.PluginVersion("Silverlight") ' => "4.1.10329.0"
Browser.PluginVersion("QuickTime") ' => ""

↑ Top of page ↑

Support(key)

Indicates whether the browser can supports the specified feature.

Returns a Boolean.

Parameters
Examples
' Suports Flash?
Browser.Support("flash") '  => true
' Supports Silverlight? 
Browser.Support("silverlight") '  => false
' Supports touch events?
Browser.Support("touch") '  => true
' Supports cookies?
Browser.Support("cookies") '  => true
' Supports the HTML 5 video tag?
Browser.Support("video") '  => false

↑ Top of page ↑

ToString()

Returns a string which represents the current Browser object.

Returns a String.

Example
Browser.ToString()  ' => <Browser::123456> 
' (TODO::Probably have to be improved or 
' done differently like XML or JSON format)

↑ Top of page ↑

TypeOf()

Always returns "browser".

Returns a String.

Example
Browser.TypeOf() ' => "browser" 

↑ Top of page ↑

Credits

↑ Top of page ↑

Plugin keys

The possible plugin keys are as follows.

Keys are not case-sensitive, e.g. "Flash" and "flash" are equivalent.

Keys

Key Description Example
Flash Version of the Flash plugin, or an empty string when not installed. "11.2.202.235"
QuickTime Version of the QuickTime plugin, or an empty string when not installed. ""
WindowsMediaPlayer Version of the WindowMediaPlayer plugin, or an empty string when not installed. ""
Silverlight Version of the Silverlight plugin, or an empty string when not installed. "4.1.10329.0"
VLC Version of the VLC plugin, or an empty string when not installed. ""
AdobeReader Version the Adobe PDF Reader, or an empty string when not installed. "10.1.3.0"
PDFReader Version of other PDF reader, or an empty string when not installed. ""
RealPlayer Version of Real Player plugin, or an empty string when not installed. ""

↑ Top of page ↑

Feature keys

The possible feature keys are as follows.

Keys are not case-sensitive, e.g. "Flash" and "flash" are equivalent.

Plugin keys

Key

Description
Flash Indicates whether the browser supports the Flash plugin
QuickTime Indicates whether the browser supports the QuickTime plugin
WindowsMediaPlayer Indicates whether the browser supports the Windows Media Player plugin
Silverlight Indicates whether the browser supports the Silverlight plugin
VLC Indicates whether the browser supports the VLC plugin
AdobeReader Indicates whether the browser supports the Adobe PDF Reader plugin
PDFReader Indicates whether the browser supports any other PDF Reader plugin
RealPlayer Indicates whether the browser supports the Real Player plugin

 

↑ Top of page ↑

 

HTML5 and HTML generic keys

Key Description
Javascript Indicates whether the browser supports JavaScript
Touch Indicates whether the browser supports the HTML5 touch events API
GeoLocation Indicates whether the browser supports the HTML5 Geo Location API
PostMessage Indicates whether the browser supports the HTML5 Post Message API
HashChange Indicates whether the browser supports the HTML5 HashChange event
History Indicates whether the browser supports the HTML5 History API
DragAndDrop Indicates whether the browser supports the HTML5 Drag And Drop API
FullScreen Indicates whether the browser supports the FullScreen API
SpeechInput Indicates whether the browser supports the Speech Input API
Cookies Indicates whether browser supports the cookies
Unicode Indicates whether the browser supports the unicode
StrictMode Indicates whether the browser supports the EcmaScript5 strict mode
JSON Indicates whether the browser supports the native JSON API
MathML Indicates whether the browser supports MathML
DeviceMotion Indicates whether the browser supports the devicemotion events
DeviceOrientation Indicates whether the browser suppor the deviceorientation events
Battery Indicates whether the browser supports the Battery Status API
FileReader Indicates whether the browser supports the FileReader API
FileSystem Indicates whether the browser supports the FileSystem API
IE8Compat Indicates whether the IE8 compatibility mode is enabled in Microsoft Internet Explorer

↑ Top of page ↑

HTML5 storage keys

Key Description
IndexedDB Indicates whether the browser supports the HTML5 Indexed Database API
LocalStorage Indicates whether the browser supports the HTML5 Local Storage API
SessionStorage Indicates whether the browser supports the HTML5 Session Storage API
ApplicationCache Indicates whether the browser supports the HTML5 Offline Application Cache API

↑ Top of page ↑

HTML5 communication keys

Key Description
WebSockets Indicates whether the browser supports the HTML5 WebSockets API
WebSocketsBinary Indicates whether the HTML5 WebSockets API can accept binary data
WebWorkers Indicates whether the browser supports the HTML5 WebWorkers API

↑ Top of page ↑

HTML5 graphics keys

Key Description
Canvas Indicates whether the browser supports the HTML5 Canvas API
CanvasText Indicates whether the browser supports the HTML5 Canvas Text API
WebGL Indicates whether the browser supports the HTML5 WebGL API
SVG Indicates whether the browser supports the HTML5 SVG API

↑ Top of page ↑

HTML5 video keys

Key Description
Video Indicates whether the browser supports the HTML5 <video> tag
Ogg Indicates whether the browser supports the Ogg codec
H264 Indicates whether the browser supports the H264 codec
WebM Indicates whether the browser supports the WebM codec

↑ Top of page ↑

HTML5 audio keys

Key Description
Audio Indicates whether the browser supports the HTML5 <audio> tag
mp3 Indicates whether the browser supports the mp3 codec
wav Indicates whether the browser supports the wav codec
m4a Indicates whether the browser supports the m4a codec

↑ Top of page ↑

HTML5 forms (inputs, attributes etc) keys

Key Description
Tags
OutputElem Indicates whether the browser supports the HTML5 <output> tag
ProgressBar Indicates whether the browser supports the HTML5 <progress> tag
Meter Indicates whether the browser supports the HTML5 <meter> tag
Details Indicates whether the browser supports the HTML5 <details> tag
Ruby Indicates whether the browser supports the HTML5 <ruby> tag
Track Indicates whether the browser supports the HTML5 <track> tag
Inputs
Number Indicates whether the browser supports the HTML 5 <input type=number>
Range Indicates whether the browser supports the HTML 5 <input type=range>
Date Indicates whether the browser supports the HTML 5 <input type=date>
DateTime Indicates whether the browser supports the HTML 5 <input type=datetime>
DateTime-Local Indicates whether the browser supports the HTML 5 <input type=datetime-local>
Month Indicates whether the browser supports the HTML 5 <input type=month>
Week Indicates whether the browser supports the HTML 5 <input type=week>
Time Indicates whether the browser supports the HTML 5 <input type=time>
Tel Indicates whether the browser supports the HTML 5 <input type=tel>
Email Indicates whether the browser supports the HTML 5 <input type=email>
URL Indicates whether the browser supports the HTML 5 <input type=url>
Color Indicates whether the browser supports the HTML 5 <input type=color>
Search Indicates whether the browser supports the HTML 5 <input type=search>
Attributes
AutoComplete Indicates whether the browser supports the HTML5 autocomplete attribute
AutoFocus Indicates whether the browser supports the HTML5 autofocus attribute
List Indicates whether the browser supports the HTML5 datalist element and list attribute
Placeholder Indicates whether the browser supports the HTML5 placeholder attribute
Min Indicates whether the browser supports the HTML5 min attribute
Max Indicates whether the browser supports the HTML5 max attribute
Step Indicates whether the browser supports the HTML5 step attribute
Multiple Indicates whether the browser supports the HTML5 multiple attribute
Pattern Indicates whether the browser supports the HTML5 pattern attribute
Required Indicates whether the browser supports the HTML5 required attribute
FormValidation Indicates whether the browser supports the Form Validation using required and pattern attributes

↑ Top of page ↑

CSS3 keys

Key Description
MediaQueries Indicates whether the browser supports the CSS3 media queries
GeneratedContent Indicates whether the browser supports the CSS2/CSS3 generated content :before / :after / content
FontFace Indicates whether the browser supports the CSS3 web font
Flexbox Indicates whether the browser supports the CSS3 flexbox
RGBa Indicates whether the browser supports the CSS3 RGB with Alpha
HSLa Indicates whether the browser supports the CSS3 HSLA
MultipleBgs Indicates whether the browser supports the CSS3 multiple background
BackgroundSize Indicates whether the browser supports the CSS3 background size property
BorderImage Indicates whether the browser supports the CSS3 border image properties
BorderRadius Indicates whether the browser supports the CSS3 border radius properties
BoxShadow Indicates whether the browser supports the CSS3 box shadow property
TextShadow Indicates whether the browser supports the CSS3 text shadow property
Opacity Indicates whether the browser supports the CSS3 opacity property
CSSAnimations Indicates whether the browser supports the CSS3 animations properties
CSSColumns Indicates whether the browser supports the CSS3 multi-columns properties
CSSGradients Indicates whether the browser supports the CSS3 linear-gradient, radial-gradients... properties
CSSReflections Indicates whether the browser supports the CSS3 reflections properties
CSSTransforms Indicates whether the browser supports the CSS3 transforms properties
CSSTransforms3D Indicates whether the browser supports the CSS3 3D transforms properties
CSSTransitions Indicates whether the browser supports the CSS3 transitions properties

↑ Top of page ↑

Create your own Knowledge Base