How to detect Firefox in JavaScript?
I want to detect all versions of Firefox.
This will detect any version of Firefox:
const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
if (isFirefox) {
console.log("Your browser is Firefox");
} else {
console.log("Your browser is not Firefox");
}
You may want to consider using feature-detection ala Modernizr, or a related tool, to accomplish what you need.