Javascript has provided an object called navigator through which we can get the details of the browser. This navigator object has provided navigator.product and navigator.appCodeName to get the product and code names of the browser. Let's discuss them individually.
Product name
The product property returns the product name and in most of the browsers, the code name is a gecko.
Example
<html> <body> <p id="proname"></p> <script> document.getElementById("proname").innerHTML = "the product name is " + navigator.product; </script> </body> </html>
Output
the product name is Gecko
Code name
The code property returns the code name of the browser. This code name is basically "Mozilla" for Chrome, Firefox, IE, Safari, and Opera.
Example
<html> <body> <p id="coname"></p> <script> document.getElementById("coname").innerHTML = "the code name name is " + navigator.appCodeName; </script> </body> </html>
Output
the code name name is Mozilla