Introduce a new $is_edge global for the Microsoft Edge browser.

The `$is_IE` and `$is_chrome` globals no longer return `true` for Edge, which is expected as Edge is its own browser and should not be treated like IE. While it might be beneficial for Edge to be treated like Chrome on the client side, it benefits nobody for the `$is_chrome` global to return true.

See #33193
Props gregrickaby, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@33927 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2015-09-05 22:33:01 +00:00
parent 2d68434dff
commit 07861df743

View File

@ -16,7 +16,7 @@
*/
global $pagenow,
$is_lynx, $is_gecko, $is_winIE, $is_macIE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $is_IE,
$is_lynx, $is_gecko, $is_winIE, $is_macIE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $is_IE, $is_edge,
$is_apache, $is_IIS, $is_iis7, $is_nginx;
// On which page are we ?
@ -48,11 +48,13 @@ if ( is_admin() ) {
unset($self_matches);
// Simple browser detection
$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false;
$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = $is_edge = false;
if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) {
$is_lynx = true;
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Edge' ) !== false ) {
$is_edge = true;
} elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false ) {
if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chromeframe' ) !== false ) {
$is_admin = is_admin();