• Hi,

    Thanks for this great plugin!

    My question: is it possible to exclude browser specific resources, notably for IE, from being pushed?

    For example, the default Twenty Seventeen theme includes a html5.js and a ie8.css for IE8/9 which, when HTTP/2 Server Push is activated, are pushed to ALL browsers. In fact, they are pushed ONLY to browsers that do not need them because IE8 and 9 do not even support HTTP2…

    I see a $src filter in the plugin which could be used like this:

    
    function my_http2_exclude_filter( $src ) {
        $exclude = array( 'ie8.css', 'html5.js');
        foreach ( $exclude as $str ) {
            if ( stripos($src, $str) ) $src = "";
        }
        return $src;
    }
    add_filter('http2_link_preload_src', 'my_http2_exclude_filter');
    

    But I realize filtering based on file name is not a very elegant solution… Anyone know a better way?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to exclude browser specific sources?’ is closed to new replies.