Graeme 0 Report post Posted June 29, 2007 Here is the code that i picked up from a Javascript book that will tell you wether you are using Firefox or Internet explorer. obviously the (navigator.appName =="browser name") can be changed to different browsers. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 - Transitional//EN"><html xmlns="http://www.w3.org/1999/xhtml/;<head> <title>What's your browser?</title></head><body bgcolor="#FFFFFF"><h2> <script language="Javascript1.5" type="text/javascript"> <!-- Hide script from old browsers if (navigator.appName =="Firefox") { document.write("You are running a Firefox browser") } else { if (navigator.appName == "Microsoft Internet Explorer") { document.write("You are running Internet Explorer") } else { document.write("You're not using Internet Explorer or Firefox, maybe you should!") } } // End hiding script from old browsers --> </script></h2></body></html> Share this post Link to post Share on other sites
Tetraca 0 Report post Posted June 30, 2007 Wouldn't it be easier to do this server side with PHP? By the time you get to using javascript usually the browser matters less. Share this post Link to post Share on other sites
Saint_Michael 3 Report post Posted June 30, 2007 I have to concur especially since that most people disable javascript to begin with and doing it through php would be a lot cleaner and a lot smaller in the code size as well. <?php echo $_SERVER["HTTP_USER_AGENT"]; ?> That little one line of php cod and you just displayed the person's browser without making hte document look unorganized and large in document size Share this post Link to post Share on other sites
Graeme 0 Report post Posted July 2, 2007 Oh.I'm working my way through Javascript at the moment.Going to move onto Perl/PHP soon. Share this post Link to post Share on other sites