Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using window.opera

6 views
Skip to first unread message

Jeremy

unread,
Aug 21, 2008, 7:07:41 PM8/21/08
to
I am currently using window.opera to detect Opera in javascript, in
order to work around a particular Opera quirk. There is no real way for
me to detect this quirk with feature detection, and I figure
window.opera is more reliable than UA parsing.

What's the consensus on using this method? Is it evil like UA parsing,
or is it more acceptable? Is window.opera going to go away any time
soon? (It's probably fairly doubtful that window.opera will start being
used by other UAs, right?)

Thanks,
Jeremy

Eik

unread,
Aug 21, 2008, 7:28:08 PM8/21/08
to
On Fri, 22 Aug 2008 00:07:41 +0100, Jeremy <jer...@pinacol.com> wrote:

> I am currently using window.opera to detect Opera in javascript, in
> order to work around a particular Opera quirk. There is no real way for
> me to detect this quirk with feature detection, and I figure
> window.opera is more reliable than UA parsing.
>
> What's the consensus on using this method?

It's a very good and reliable way of detecting Opera, and is definately a
preferable method to use, along with its child properties/methods like
opera.version() rather than user agent strings or other 'indirect' tests
for objects/methods.


> Is window.opera going to go away any time soon?

Highly unlikely as it's been available since the Opera 3.x days. Unless
Opera gets a 75% market share, I can't see other browsers copying it in
order to spoof as Opera, and I can't foresee any other need for an object
called 'opera' in future browsers.

So while it's not impossible that future browsers will have an 'opera'
object, it's considerably less likely than the user agent being spoofed.

0 new messages