How to make element appear only to Mozilla Firefox users

3

I have a site that is not half misaligned in Mozilla Firefox , I tested it in some browsers, including Internet Explorer , which by the way displayed the page perfectly. >

Only Mozilla Firefox has this problem. At the moment I'm kind of out of time to try to solve this, so I want it when the person accesses the site, a warning is displayed for it, indicating the use of another browser.

Code sample:

<div id="mozilla"> Percebemos que você está utilizando o navegador Mozilla.
     Para uma melhor interação com nosso site, indicamos que utilize
    outro navegador, como Google Chrome, Internet Explorer, etc.
<span id="x">Fechar</span> </div>
  

Is it possible to make this warning appear only if the person accesses the page using the Mozilla Firefox browser?

Another little thing, how to give style="display:none" to <div> , if the person clicks close?

    
asked by anonymous 04.11.2016 / 07:48

1 answer

3
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') != -1;

This line searches for the word firefox in the browser's digital signature, in the userAgent string.

If isFirefox is true is a Firefox browser.

    
04.11.2016 / 10:11