[thelist] detecting opera

Peter-Paul Koch gassinaumasis at hotmail.com
Thu Aug 23 12:14:33 CDT 2001

>>IE4+, instead check if the browser supports any advanced DOM
>>(document.layers, document.all or document.getElementById). Much safer in 
>>the long run.
>I actually got burned by this recently. I used a some fairly high-end DOM 
>stuff that was enabled after a a check for
>"document.getElementById". Unfortunately, Opera supports that, but
>hardly anything else usable in the DOM:

Yep, that's a problem. But I meant Version 4 compatible DHTML, which Opera 
supports fairly, not Version 5 compatible DOM manipulation which it doesn't 
support at all.

>I've got around it by detecting Opera on the server-side, as I'm wary of 
>checking for various DOM items (document.getElementById,
>document.createElement, document.styleSheets, document.getAttribute, etc.).

Why? if (document.getElementById && document.createElement) is a safe test 
to see if the browser can handle advanced DOM manipulation. You check 
directly if the browser can create new elements. If it can, it can handle 
advanced scripts.


Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

More information about the thelist mailing list