Merge pull request #989 from lucbloom/android-stock-browser

Android stock browser check
This commit is contained in:
Richard Davey 2014-08-28 02:01:25 +01:00
commit ee579c2b0d

View file

@ -900,3 +900,16 @@ Phaser.Device.prototype = {
};
Phaser.Device.prototype.constructor = Phaser.Device;
/**
* A class-static function to check wether were running on an Android Stock browser.
* Autors might want to scale down on effects and switch to the CANVAS rendering method on those devices.
* Usage: var defaultRenderingMode = Phaser.Device.isAndroidStockBrowser() ? Phaser.CANVAS : Phaser.AUTO;
*
* @function Phaser.Device#isAndroidStockBrowser
*/
Phaser.Device.isAndroidStockBrowser = function()
{
var matches = window.navigator.userAgent.match(/Android.*AppleWebKit\/([\d.]+)/);
return matches && matches[1] < 537;
};