...

View Full Version : :: ok browser detect? ::



babelfish
07-03-2002, 05:05 PM
<script language ="JavaScript" type="text/javascript">
if (document.getElementById)
{
document.write('<\script src="files/goodbrowser.js" type="text/javas\cript" language="Java\script"></s\cript>');
document.close();
}
else
{
document.write('<\script src="files/lamebrowser.js" type="text/javas\cript" language="Java\script"></s\cript>');
document.close();
}
</script>

will that work ok? im sick of trying to make stuff look nice in NS4x so will the above use the funky menus for IE5, NS6, moz and IE5+ mac? opera, and use lame menu for old crud like NS4 and IE4 etc.?

thanks!

brothercake
07-03-2002, 06:29 PM
seems reasonable - ie4 and ns4 won't get through that test, but all the others you mentioned will. Dunno if you can really count opera in amongst the power browsers .... I like it very much, but for DHTML it sucks badly - might be safer to add it to the crud group, which you can do like this



if (document.getElementById&&!window.opera) {

....


btw - for strict compliance you would need to go


if (typeof document.getElementById!="undefined"&&typeof window.opera=="undefined") {

...

babelfish
07-04-2002, 08:41 AM
thanks m8!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum