mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
Merge pull request #989 from lucbloom/android-stock-browser
Android stock browser check
This commit is contained in:
commit
ee579c2b0d
1 changed files with 13 additions and 0 deletions
|
@ -900,3 +900,16 @@ Phaser.Device.prototype = {
|
|||
};
|
||||
|
||||
Phaser.Device.prototype.constructor = Phaser.Device;
|
||||
|
||||
/**
|
||||
* A class-static function to check wether we’re 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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue