1

Non-Webkit Opera was very specific in some features, so it was usually detected via JavaScript the following way.

However, Opera Next seeps to be almost a Google Chrome clone.

How can I target old Opera and not target Opera Next?


PS: I really do know that browser detection sucks and feature detection rules. But I hope to update the big and running project with a tiny browser-detection-patch rather then to rewrite tons of code into feature-detection paradigm.

Community
  • 1
  • 1
Dan
  • 55,715
  • 40
  • 116
  • 154

1 Answers1

2

I have found the problem source. It was in bad browser detection in that project. If you detect Opera exactly like in the link given in the question, Opera Next is not detected to be Opera, so Old-Opera-Specific code is not executed, and Chrome-Specific-Code runs instead.

 !!window.opera;                      // true in old Opera, false in Opera Next

 navigator.userAgent.indexOf("Opera");//   -------    the same    --------

PS: Fortunately, I have lots of tests on my project, so I can tell that in new Opera things are working exactly as in Google Chrome.

A piece of code that caused problems tried to detect Opera Old AND Opera Next:

/(Opera|OPR)/.test(navigator.userAgent)

Conclusion: Opera migration was made very well, nothing should break in your projects. Do not detect Opera Next and simply treat it as usual Google Chrome.

UPDATE: previous Opera versions had gone from caniuse.com

Community
  • 1
  • 1
Dan
  • 55,715
  • 40
  • 116
  • 154