View Full Version : [FIXED] Ext.browser.is.WebView should be false for Ext.os.is.Desktop

1 May 2012, 5:04 AM

Ext version tested:

Sencha Touch 2.0.1

Browser versions tested against:

Safari 5.1.5
PhoneGap 1.5.0

DOCTYPE tested against:



If you add the PhoneGap script tag to your index.html and require Ext.device.Device, you'll get the following error:
JavaScript error: ReferenceError: Can't find variable: device on line 10 for sdk/src/device/device/PhoneGap.js. This is because the Ext.browser.is.WebView flag only checks for the existence of window.PhoneGap (or Cordova), while it should also check if we're in fact on a phone. Because it doesn't, the Ext.device.* classes construct the PhoneGap subclasses. And since Ext.device.Device.PhoneGap tries to read device.* upon construction.. it fails.

Steps to reproduce the problem:

Create a blank app
Add the PhoneGap/Cordova script and script-tag
Open the app on your desktop (or try to sencha app build package it).

The result that was expected:

Use of the Ext.device.*.Simulator classes

The result that occurs instead:

Use of the Ext.device.*.Phonegap classes
The described error


Debugging already done:

Hours of trail and error

Possible fix:

Only set the WebView flag if we're on a phone

Additional CSS used:

only default ext-all.css

Operating System:

Mac OS X Lion

1 May 2012, 5:23 AM
Thank you for the report.

3 May 2012, 8:41 AM
Fixed for the next release. Thanks!