title: Detect browser user with javascript
body: <p>I'm new in this board but I have read you for years. :)</p>
  
  <p>I'm trying to learn to code, but I'm in the first steps yet. However, I'm going to use a script to detect the user's browser. </p>
  
  <p>This work with all the mainly browser (I tried it on chrome, firefox and IE), but it <strong>doesn't work with Edge</strong>. How can I fix it? Thank you!</p>
  
  <pre><code>&lt;p style="text-align: center;"&gt;Hi user, you're using: 
  
  &lt;script&gt;
  
  var ba = ["Chrome","Firefox","Safari","Opera","MSIE","Trident","Edge"];
  var b, ua = navigator.userAgent;
  for(var i=0; i &lt; ba.length; i++){
  if( ua.indexOf(ba[i]) &gt; -1 ){
      b = ba[i];
      break;
      }
  }
  if(b == "MSIE" || b == "Trident" || b == "Edge 20+"){
  b = "Internet Explorer";
  }
  document.write(b + " browser");
  
  &lt;/script&gt;
  </code></pre>