Opened 4 years ago
Last modified 4 years ago
#46132 new defect (bug)
Opera changed its render engine to Chrome, $is_opera not working
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 2.2 |
Component: | General | Keywords: | needs-patch |
Focuses: | Cc: |
Description
Nowadays, Opera is being detected as "chrome" and $is_opera
returns false.
String detection should include 'OPR'
in
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/vars.php#L86
Attachments (1)
Change History (3)
#1
@
4 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
- Version changed from 5.0.2 to 2.2
#2
@
4 years ago
Thanks for taking a look, @desrosj
I discovered this when I needed a specific CSS rule for Opera (using the body_class
filter). And that's because Chrome has an ongoing bug not present in Opera: we can't drag bookmarklets into the bookmarks bar since Chrome 69.
I don't think it'd be a good idea to convert $is_opera
to $is_chrome
, this kind of mishap among browsers is bound to happen even if everybody changes their render-engine to Chromium :)
I'm attaching the needed patch, hope the format is correct.
Checking for Opera has to be done before Chrome's so as not to give a false positive.
Thanks for the ticket, @brasofilo!
I did some digging, and this Opera check appears to originally have come from b2 (fun!).
Since Opera now uses Chromium, I'd be curious if
$is_opera
related conditionals throughout core can be removed in favor of$is_chrome
. Differences in the browser's behaviors should be looked into, though.For reference, here is the official documentation for the Opera's user agent.
@brasofilo are you interested in creating a patch for this?