Support » Plugin: Cloudflare » Console error

  • Resolved Gulshan Kumar

    (@thegulshankumar)



    Hi,

    I am using HTTP/2 push. My HTML document has a conditional comment for IE 9

    <!--[if lt IE 9]>
    <script type='text/javascript' src='https://www.example.com/wp-content/themes/genesis/lib/js/html5shiv.js?ver=3.7.3'></script>
    <![endif]-->

    When I browse my page in Chrome, in console I get an warning message.

    The resource https://www.example/com/wp-content/themes/genesis/lib/js/html5shiv.js?ver=3.7.3 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it wasn't preloaded for nothing.

    Please let me know, would be possible to exclude IE elements such as html5shiv.js from the link header?

    Thanks & Regards,
    Gulshan

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author thellimist

    (@furkan811)

    Hi @thegulshankumar,

    Currently there isn’t an easy way to get rid of that warning. If you know how to code, you can play with the code locally.

    Be aware that any changes you make to the plugin code in your server, once the plugin is updated the changes will be reverted.

    Thanks

    Gulshan Kumar

    (@thegulshankumar)

    Thanks for the response. As an alternative solution, I started using W3TC together. It has an inbuilt option for the server push, working fine, it doesn’t carry IE elements.

    Gulshan Kumar

    (@thegulshankumar)

    This is how I fixed this problem.

    As I come to know that problem was happening only when the file was loaded from the local path. So, I thought to migrate the problematic script to the external CDN path.

    First, I did research that how to find the handle.

    I found html5shiv.js detail via below function code.

    function crunchify_print_scripts_styles() {
        // Print all loaded Scripts
        global $wp_scripts;
        foreach( $wp_scripts->queue as $script ) :
            echo $script . '  **  ';
        endforeach;
     
        // Print all loaded Styles (CSS)
        global $wp_styles;
        foreach( $wp_styles->queue as $style ) :
            echo $style . '  ||  ';
        endforeach;
    }
     
    add_action( 'wp_print_scripts', 'crunchify_print_scripts_styles' );

    Once I found that handle name is html5shiv, I add below code

    // remove html5shiv.js
    function remove_html5shiv_script() {
       wp_dequeue_script( 'html5shiv' );
    }
    add_action( 'wp_print_scripts', 'remove_html5shiv_script', 100 );

    Then I copy-pasted IE script in the head via Genesis Simple Hook plugin

    <!--[if lt IE 9]><script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js'></script><![endif]-->

    Marking this thread as resolved.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Console error’ is closed to new replies.