Live Chat Icon For mobile
Live Chat Icon

How the browser name can be detected?

Platform: ASP.NET| Category: Client Side Scripting

We can use navigator.appName property, to identify the browser we are using .For Netscape browsers, the value of navigator.appName is ‘Netscape’. For Microsoft Internet Explorer browsers,the value of navigator.appName is ‘Microsoft Internet Explorer’ .

The following code is used for browser detection.

function BrowserDetect()
{

                document.write(’navigator.appName = ’+navigator.appName+’
’)
	document.write(’navigator.userAgent = ’+navigator.userAgent+’
’)

	if ((navigator.userAgent).indexOf('Opera')!=-1)
	{
 		document.write('You are using an Opera browser.')
	}
	else if (navigator.appName=='Netscape') 
	{
 		document.write('You are using a Netscape browser.')
	}
	else if ((navigator.appName).indexOf('Microsoft')!=-1) 
	{
		 document.write('You are using Microsoft Internet Explorer.')
	}
}

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.