How to detect Firefox in JavaScript?
I want to detect all versions of Firefox.
For a long time I have used the alternative:
('netscape' in window) && / rv:/.test(navigator.userAgent)
because I don't trust user agent strings. Some bugs are not detectable using feature detection, so detecting the browser is required for some workarounds.
Also if you are working around a bug in Gecko, then the bug is probably also in derivatives of Firefox, and this code should work with derivatives too (Do Waterfox and Pale Moon have 'Firefox' in the user agent string?).