Make WordPress Core


Ignore:
Timestamp:
09/05/2015 10:33:01 PM (11 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/vars.php

    r32963 r33927  
    1717
    1818global $pagenow,
    19         $is_lynx, $is_gecko, $is_winIE, $is_macIE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $is_IE,
     19        $is_lynx, $is_gecko, $is_winIE, $is_macIE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $is_IE, $is_edge,
    2020        $is_apache, $is_IIS, $is_iis7, $is_nginx;
    2121
    … …  
    4949
    5050// Simple browser detection
    51 $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false;
     51$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = $is_edge = false;
    5252
    5353if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
    5454        if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) {
    5555                $is_lynx = true;
     56        } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Edge' ) !== false ) {
     57                $is_edge = true;
    5658        } elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false ) {
    5759                if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chromeframe' ) !== false ) {
Note: See TracChangeset for help on using the changeset viewer.