Sunday, March 12, 2017

Sencha Touch - Environment Detection

It helps you in identifying which operating system you are using, which browser you are working on and what are the features available for your environment.
So sencha touch provides you different function to get information specific to the environment.
All the methods mentioned below can be checked in if condition as if(Ext.os.is.Windows){} and based on the condition tasks can be performed.

below all methods returns boolean value.

Operating system:

Ext.os is class gives you different methods to know which operating system we are working on.
Method Description
Ext.os.is.webOS This function will return true if you are using webos operating system else it returns false.
Ext.os.is.RIMTable This function will return true if you are using RIMTable operating system else it returns false.
Ext.os.is.Linux This function will return true if you are using Linux operating system else it returns false.
Ext.os.is.Windows This function will return true if you are using windows operating system else it returns false.
Ext.os.is.MacOs This function will return true if you are using Mac operating system else it returns false.
Ext.os.is.BlackBerry This function will return true if you are using BlackBerry operating system else it returns false.
Ext.os.is.iOS This function will return true if you are using IOS operating system else it returns false.
Ext.os.is.Android This function will return true if you are using Android operating system else it returns false.

Device detection

Method Description
Ext.os.is.iPad This function will return true if you are using iPad else it returns false.
Ext.os.is.iPhone This function will return true if you are using iPhone else it returns false.
Ext.os.is.iPod This function will return true if you are using iPod else it returns false.

Version of operating system

Method Description
Ext.os.name It returns the name of the operating system.
Ext.os.version.version It gives the version of operating system we are using.

Browser detection

Method Description
Ext.browser.is.IE This function returns true if we are using Internet explorer browser else it returns false.
Ext.browser.is.FF This function returns true if we are using FireFox browser else it returns false.
Ext.browser.is.Chrome This function returns true if we are using Chrome browser else it returns false.
Ext.browser.is.Opera This function returns true if we are using Opera browser else it returns false.
Ext.browser.is.Safari This function returns true if we are using Safari browser else it returns false.
This function Ext.browser provides various other functions:
Method Description
Ext.browser.userAgent It returns the current userAgent.
Ext.browser.isSecure It returns true if the current page is using SSL.
Ext.browser.isStrict It returns true if the browser is in strict mode.
Ext.browser.engineName It returns the browser engine name (WebKit, Gecko, Presto, Trident and Other).
Ext.browser.engineVersion It returns the version of the browser engine.

Features

Ext.feature.has is to check if the browser has following feature or not.
Method Description
Ext.feature.has.Audio This method returns true if browser supports audio tag feature of html5.
Ext.feature.has.Canvas This method returns true if browser supports canvas tag feature of html5.
Ext.feature.has.classList This method returns true if browser supports classlist feature of html5 which is used to add, remove and toggle css classes for the html element.
Ext.feature.has.Css3dTransforms This method returns true if browser supports Css 3d Transform feature of css3.
Ext.feature.has.CssAnimations This method returns true if browser supports animations of css3.
Ext.feature.has.CssTransforms This method returns true if browser supports Css transform feature of css3.
Ext.feature.has.CssTransitions This method returns true if browser supports transition feature of css3.
Ext.feature.has.DeviceMotion This method returns true if browser supports the device motion feature.
Ext.feature.has.Geolocation This method returns true if browser supports the Geolocation feature of html5.
Ext.feature.has.History This method returns true if browser Supports history feature of html.
Ext.feature.has.Orientation This method returns true if browser can detect which the device orientation.
Ext.feature.has.OrientationChange This method returns true if browser can detect change in Orientation of the device.
Ext.feature.has.Range Range is a type of html input tag for range slider element so if browser supports slider this function returns true.
Ext.feature.has.SqlDatabase Web sql database is a web page api for storing data n database on which we can perform query operations. This method returns true if browser supports web Sql Database.
Ext.feature.has.Svg Svg stands for Scalable Vector Graphics this method returns true if browser supports html 5's svg feature.
Ext.feature.has.Touch This method returns true if browser has Touch feature.
Ext.feature.has.Video This method returns true if browser supports html 5 video tags.
Ext.feature.has.Vml Vml stands for vector markup language which is an xml based markup language. So this method returns true if browser has supports vml.
Ext.feature.has.WebSockets Web socket is basically a communication protocol for computers which supports two communication between clients and server. This method returns true if browser Supports WebSockets else it returns false.

No comments:

Post a Comment