The environment package in Sencha Touch gives you an API which tells about the environment your application is running on.
Operating System:
We can detect the operating system your application is running on using Ext.os.name.It retruns the following values:
if (Ext.os.is.Android)
if (Ext.os.is.iPad)
if (Ext.browser.is.Chrome)
For example, if you want to check if the browser supports canvas, you check use the following code:
Operating System:
We can detect the operating system your application is running on using Ext.os.name.It retruns the following values:
- Android
- iOS
- Blackberry
- Other
if (Ext.os.is.Android)
{
// ...
}
if (Ext.os.is.MacOS)
{
// ...
}
We can also detect if the device is an iPhone or iPad using Ext.os.is
We can also detect if the device is an iPhone or iPad using Ext.os.is
if (Ext.os.is.iPad)
{
// ...
}
we can also detect version of the operation system your application is running on using Ext.os.version
Browser:
We can find information about the browser you are running your application on by using Ext.browser.name
It returns the following values:
- Safari
- Chrome
- Opera
- IE
- Other
if (Ext.browser.is.Chrome)
{
// ...
}
Features:
You can use the Ext.feature singleton to check if a certain browser feature exists.
if (Ext.feature.has.Canvas)
{
// ...
}
No comments:
Post a Comment