abc abc - 3 months ago 9
Javascript Question

displays on mozilla as browser name when used in other browsers

Below is the code that i used to display the browser name on page load as an alert but it is displaying the browser name as mozilla when i am running in google chrome,mozilla and firefox but what i need is when using chrome it should display alert as browser name chrome and when running in firefox as browser name firefox and when running in internet explorer as browser name Ie but my below script shows only mozilla

<script>
alert("Browser Name : " + window.navigator.appCodeName);
</script>

Answer

you can user vendor:

window.navigator.vendor

but on microsoft edge and internet explorer this value will be empty.