Skip to content

Commit 0f6dd1a

Browse files
committed
Device.firefoxVersion is a new property that contains the major Firefox version number if running within Firefox, otherwise zero.
1 parent 7c9db8f commit 0f6dd1a

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ Version 2.4 - "Katar" - in dev
296296
* Frame.resize allows you to change the dimensions of a Frame object and recalculate all of its internal properties (such as `bottom` and `distance`).
297297
* LoadTexture.resizeFrame lets you resize the Frame dimensions that the Game Object uses for rendering. You shouldn't normally need to ever call this, but in the case of special texture types such as Video or BitmapData it can be useful to adjust the dimensions directly in this way.
298298
* Rectangle.bottomLeft has been added (thanks @mattmogford #1788)
299+
* Device.firefoxVersion is a new property that contains the major Firefox version number if running within Firefox, otherwise zero.
299300

300301
### Updates
301302

src/system/Device.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,12 @@ Phaser.Device = function () {
262262
*/
263263
this.firefox = false;
264264

265+
/**
266+
* @property {number} firefoxVersion - If running in Firefox this will contain the major version number.
267+
* @default
268+
*/
269+
this.firefoxVersion = 0;
270+
265271
/**
266272
* @property {boolean} ie - Set to true if running in Internet Explorer.
267273
* @default
@@ -847,9 +853,10 @@ Phaser.Device._initialize = function () {
847853
{
848854
device.epiphany = true;
849855
}
850-
else if (/Firefox/.test(ua))
856+
else if (/Firefox\D+(\d+)/.test(ua))
851857
{
852858
device.firefox = true;
859+
device.firefoxVersion = parseInt(RegExp.$1, 10);
853860
}
854861
else if (/AppleWebKit/.test(ua) && device.iOS)
855862
{

0 commit comments

Comments
 (0)