[thelist] Re: Browser Detection

Ben Gustafson ben_gustafson at lionbridge.com
Fri Feb 23 10:27:15 CST 2001


Hi Barret,

If all you want to do is detect for a browser that is not IE or Netscape and
is older than version 4, and then display your alert box, use this script:

	<script language="JavaScript1.2"><!--
	var name = navigator.appName;
	var version = parseInt(navigator.appVersion);
	if ((name != "Microsoft Internet Explorer" || name != "Netscape") &&
(version < 4)) {
		alert("Our web site is best viewed with Netscape Communicator or Internet
Explorer version 4 or higher. Some aspects of our web site will be displayed
incorrectly with your browser. If possible, please download a copy of
Netscape or Internet Explorer version 4 or better. Thank you.");
	}
	//--></script>

You may also want to do some reading on browser detection, such as The
Ultimate JavaScript Client Sniffer, as noted by other evolters. You should
also keep in mind that asking visitors to go get another browser and come
back to view your site is an easy way to make sure they go away and don't
come back. It would be better to test your site in different
browser/version/platform combinations, and where possible, use browser
detection to fix the parts that break in certain combinations. And even this
won't help you with browsers that have JavaScript disabled.

--Ben
________________
Ben Gustafson
Webmaster
Lionbridge Technologies, Inc.
www.lionbridge.com





More information about the thelist mailing list