oalders/http-browserdetect

Opera incorrecty recognized

Closed this issue · 0 comments

Opera 12.16 has UA like:
Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.16

Opera STABLE (>15.x) has UA like:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36 OPR/18.0.1284.49

Usable code for detection of modern Opera desktop browsers:

Line 336:

  # new Useragent since Opera 10 and new Opera 15 
  # see http://my.opera.com/ODIN/blog/2013/07/15/opera-user-agent-strings-opera-15-and-beyond  
  #       http://my.opera.com/community/openweb/idopera/
  if ( m{opera\/9\.80\s.+\sversion\/(\d*)\.?(\d+)|ope?ra?[\/\s](\d*)\.?(\d+)}i ) {
     $major=$1//$3;
     $minor=$2//$4;
  }

Line 489:

  $tests->{OPERA}  = ( index( $ua, "opera" ) != -1 or index( $ua, "opr" ) != -1 );

Please check this and include detection of Opera in newer module.
Thanks.