Forum Moderators: open
<script language="JavaScript" type="text/javascript">
var browser = (document.all)? "IE" :
(document.layers)? "Netscape" : "other"
alert(browser);
</script>
This gives me "other" for Netscape, and "IE" for Opera, even when it's set to ID itself as Opera.
What's the best way to test for this? (I only need to know IE, Netscape, and 'other'.)
The entire point of object detection is that you don't care which browser is being used, but instead what that browser is capable of. If you're trying to use object detection to determine if a browser is IE, Netscape, or something else, you're doing it wrong.
Ask Google about [javascript object detection]. quirksmode [quirksmode.org] is a pretty good resource, and I'm sure you'll find others.
[edited by: DrDoc at 6:03 pm (utc) on Mar. 14, 2006]
[edit reason] linked to resource [/edit]
if (document.getElementById){
var imgobj=document.getElementById(loadarea)
if (imgobj.filters && window.createPopup){
imgobj.style.filter=filterstring
imgobj.filters[0].Apply()
}
The script says it works with IE5+, NS6+, and Opera 7+. From what I've read about function support for those three, 'getElementById' is the one. Does 'imgobj.filters && window.createPopup' matter?
P.S. Doc - I don't find 'document.createElement' in the script; does that mean it's not used, or are there other expressions using that function? The only things resembling 'create' are the popup thing noted above, and this line:
var myimage=new Image()