-1

As the title suggest, I'd like to put a div (with a message in it) on the page that will be displayed on Firefox using jQuery only. How do I go about doing this? Thank you.

WebGuy7767
  • 67
  • 9
  • Does this answer your question? [How can I detect browser type using jQuery?](https://stackoverflow.com/questions/19352522/how-can-i-detect-browser-type-using-jquery) – Nitin Sawant Jun 12 '22 at 18:24
  • @NitinS not really as that's a very outdated question. `$.browser` was [removed from jQuery in 1.9](https://api.jquery.com/jquery.browser/). Browser sniffing as a concept is now bad practice. The far better approach is to use feature detection. – Rory McCrossan Jun 12 '22 at 19:41
  • How do you use feature detection? – WebGuy7767 Jun 12 '22 at 21:11

1 Answers1

1

Try to use this:

// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';

if (isFirefox) {
    var $body = $('body');
    
    $body.append('<div>You are using Mozilla browser.</div>');
}
Richard Dobroň
  • 687
  • 4
  • 6