Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

browser detection

Status
Not open for further replies.

NEVERSLEEP

Programmer
Apr 14, 2002
667
CA
huum i need help with this...
i want to make a browser detection script
that will detect if browser is recent enough
for IE and NS no problem but i want to allow a maximum
of possible browser (like opera,aol...)
i read this
but that too much for nothing
can someone help me with this...thnks

someone knowledge ends where
someone else knowledge starts
 
I recommend that instead of checking for browsers you check for what functionality exist on a certain browser :

if (document.all)
{
// code with document.all dom
}
else if (document.getElementById)
{
// code with document.getElementById
}

you can also use this to check if something exists :

if (window.innerHeight)
{
var winH = window.innerHeight
}

etc...

I seperate my browser checking code into three main families. ieDom, ns4Dom, and w3cDom. The advantage is that if the code checks wether or not a feature exists it doesn't need to be upgraded as often.

Does this make sense to you? Gary Haran
 
I vote for xutopia's suggestion.
I would also add check-up for (document.layers) that corresponds only to NN4.x if you need it.

(document.all) is for IE4 only since IE5 and above "understand" getElementById.

(document.getElementById) is sufficient for IE5+, all Gecko-based browsers (Mozilla, Netscape 6.x, Galeon, etc) and Opera 5+.

If you want to know more about Opera identification, read this: faq216-1512

good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top