Skip to content
Browse files

better opera detection

  • Loading branch information...
1 parent e7d8241 commit 2c4167a15191872fddd67d14bac570df9afdf6dc @paulirish committed Feb 1, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/env.js
View
2 src/env.js
@@ -3,7 +3,7 @@
fuse.env = {
'agent': {
'IE': isHostObject(global, 'attachEvent') && userAgent.indexOf('Opera') < 0,
- 'Opera': userAgent.indexOf('Opera') > -1,
+ 'Opera': /Opera/.test(toString.call(window.opera)),
'WebKit': userAgent.indexOf('AppleWebKit/') > -1,
'Gecko': userAgent.indexOf('Gecko') > -1 && userAgent.indexOf('KHTML') < 0,
'MobileSafari': userAgent.search(/AppleWebKit.*Mobile/) > -1

3 comments on commit 2c4167a

@jdalton
jdalton commented on 2c4167a Feb 1, 2010

Good idea. Thanx :D

@fabiomcosta

Be carefull, the UA will hardly change, but Opera may remove the opera object in favor of console.
I'm not saying they will for sure but its easier then changing theyre UA.

@jdalton
jdalton commented on 2c4167a Feb 1, 2010

Opera has already changed their UA between v9 and 10. So currently the opera object is more stable :D
The sniff is pretty generalized though (only looking for the Opera keyword) so I could go either way.

Please sign in to comment.
Something went wrong with that request. Please try again.