Christian: Wie ertelle ich eine Browserabfrage ?

Beitrag lesen

Hi,

ich sollte eine Browserabfrage erstellen. Nun wie genau erstelle ich diese, was ist die beste Lösung ?

Mit JavaScript:

if(window.opera)
{
   // Opera 5 und höher
}
if(window.opera && window.print)
{
   // Opera 6 und höher
}
if(window.opera && window.clientInformation)
{
   // Opera 7
}

if(netscape)
{
   // Netscape 3
}
if(window.captureEvents && !document.getElementById && netscape)
{
   // Netscape 4
}
if(document.getElementById && !window.atob && netscape)
{
   // Netscape 6 / Mozilla 0.9
}
if(document.getElementById && window.atob && netscape)
{
   // Netscape 7 / Mozilla 1.x
}

if(window.navigate)
{
   // IE 3 und höher
}
if(document.all && !window.opera)
{
   // IE 4 und höher
}
if(document.getElementById && document.all && !window.opera)
{
   // IE 5 und höher
}
if(window.createPopup)
{
   // IE 5.5 und höher
}
if(document.body && und document.body.ownerDocument)
{
   // IE 6
}

In etwa so! 100% sicher ist sowas nie, da es ja noch andere Browser außer den 3 genannten gibt! Aber das sollte dennoch auf die genannten zutreffen!

Gruß
Christian