My JavaScript book is out! Don't miss the opportunity to upgrade your beginner or average dev skills.

Saturday, August 15, 2009

Opera Detection Revamped?

I am surfing in a nightmare of problems with IE and Opera right now ... all these problems come from sessionStorage implementation ... I am almost there, but right now just think about this question:

How to know if onload and unload event are supported without firing them?

Apparently, it has never been that simple!

Object.prototype.toString
.call(window.opera) ===
"[object Opera]"
;

Enjoy

P.S. Prototype Framework uses this trick since version 8, I had no idea about that! Good one!

No comments: