Make WordPress Core


Ignore:
Timestamp:
07/20/2016 06:18:30 PM (8 years ago)
Author:
ocean90
Message:

Script Loader: Use dns-prefetch for the Emoji CDN.

  • preconnect will be potentially pretty heavy on the CDN. With the Unicode 9.0 emoji update, almost all browsers will trigger the preconnect.
  • preconnect only opens one connection, but s.w.org is HTTP/1.1, so the browser will use the preconnected connection for the first emoji, then it has to open new connections for subsequent emoji.

Also use the same URL as we use for the emoji_svg_url filter. This will print the hint for the correct CDN in case someone uses a custom CDN.

Props peterwilsoncc.
Fixes #37387.

File:
1 edited

Legend:

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

    r38121 r38122  
    28032803    $hints = array(
    28042804        'dns-prefetch' => wp_dependencies_unique_hosts(),
    2805         'preconnect'   => array( 's.w.org' ),
     2805        'preconnect'   => array(),
    28062806        'prefetch'     => array(),
    28072807        'prerender'    => array(),
    28082808    );
     2809
     2810    /*
     2811     * Add DNS prefetch for the Emoji CDN.
     2812     * The path is removed in the foreach loop below.
     2813     */
     2814    /** This filter is documented in wp-includes/formatting.php */
     2815    $hints['dns-prefetch'][] = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' );
    28092816
    28102817    foreach ( $hints as $relation_type => $urls ) {
Note: See TracChangeset for help on using the changeset viewer.