fnando / browser

Do some browser detection with Ruby. Includes ActionController integration.
MIT License
2.45k stars 361 forks source link

`browser.safari?` is true for an Opera UA #482

Closed danfishgold closed 4 years ago

danfishgold commented 4 years ago

Using version 4.2.0

This user agent for Opera on Windows is also recognised as Safari: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 OPR/48.0.2685.52

> browser = Browser.new('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 OPR/48.0.2685.52')
=> #<Browser::Opera:0x00007fb1c595c0a8
 @accept_language=[],
 @ua="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 OPR/48.0.2685.52">

> browser.name
=> "Opera"

> browser.opera?
=> true

> browser.safari?
=> true