Writing Different Text to a Page Based on the Browser
<script type="text/javascript"> <!-- var browser = navigator.appName; document.open(); if(browser == "Netscape"){ document.write("<h2>Welcome <a href='http://www.java2s.com'>java2s.com</a> user.</h2>"); }else if(browser == "Microsoft Internet Explorer"){ document.write("<h2>Welcome <a href='http://www.java2s.com'> www.java2s.com</a> user.</h2>"); }else{ document.write("<h2>Welcome. But what browser are you using?</h2>") } document.close(); //--> </script>