Site logo

[Support request] Can not delay navigation-search.min.js

Home Forums Support [Support request] Can not delay navigation-search.min.js

Home Forums Support Can not delay navigation-search.min.js

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1830313
    Kee

    Hi,
    I am using GP with Ezoic. I enabled “script delay” option on Ezoic to improve LCP and it works. But only “/generatepress/assets/js/navigation-search.min.js?ver=3.0.3” still marked as “avoid chaining critical requests”. I contacted Ezoic support team and they told me “There are some Generate Press theme settings which can’t be fully optimised by Ezoic because of the way they’ve been configured by Generate Press, so for example Ezoic can be delaying these scripts but if GeneratePress are layering other settings on top of that then the optimisations Ezoic is doing for this script may not work optimally”

    I would like to know why this js is different from others? It seems Ezoic add an attribute “type=text/ez-screx” to delay the script.

    Best regards
    Kee

    #1830639
    David
    Staff
    Customer Support

    Hi there,

    that script is enqueued like all other scripts in GP. I am not sure how Ezoic is applying there code but if it works for the other theme scripts there is no reason it should not work for that one.

    #1830765
    Kee

    Hi David,
    Yes it looks weird. Can I add the attribute “type=text/ez-screx” to navigation-search.min.js manually? I tried to use script_loader_tag but not worked.

    Thanks for your help.

    #1830816
    David
    Staff
    Customer Support

    Hmmm… if they require the ez-screx="true" attribute then you could try this:

    add_filter( 'script_loader_tag', 'add_screx_att_to_search_scipt', 10, 3 );
     
    function add_screx_att_to_search_scipt( $tag, $handle, $src ) {
        if ( 'generate-navigation-search' === $handle ) {
            $tag = '<script type="text/javascript" src="' . esc_url( $src ) . '" id="generate-navigation-search-js" ez-screx="true"></script>';
        }
     
        return $tag;
    }
    #1830929
    Kee

    Hi,
    Thanks very much David. It could be delayed now 🙂

    #1830937
    David
    Staff
    Customer Support

    Glad to hear that – it would be nice to hear if it made any tangible performance improvement 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.