• I installed your plugin today and noticed a problem with it not displaying if we have set Javascript files to defer loading.

    We have this

    if (!(is_admin() )) {
        function defer_parsing_of_js ( $url ) {
            if ( FALSE === strpos( $url, '.js' ) ) return $url;
            if ( strpos( $url, 'jquery.js' ) ) return $url;
            // return "$url' defer ";
            return "$url' defer onload='";
        }
        add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
    }

    in our functions.php to help speed up load times and it seems.

    The plugin doesn’t work on the front-end with this function installed. Removing it instantly fixes the issue.

    We have tried several other plugins similar to yours, and they all work absolutely fine with or without the defer function in place.

    Any ideas on a fix for this?

    https://wordpress.org/plugins/cookie-law-info/

Viewing 1 replies (of 1 total)
  • Richard

    (@richardashby)

    Hi, this will probably be because of the order in which the JavaScripts are output. I’ll look into it at some point but I’m not going to have time to do anything in the next few weeks unfortunately. The main change will be to output the JSON string in the header and the Cookie Law Info JavaScript in the footer, all of which will need to be tested on a whole bunch of themes (it’s always the testing that’s the time consuming part). Sounds like you’re pretty techie so if you are up for making the fix yourself and repost then I’ll happily incorporate it and credit you with the solution?

Viewing 1 replies (of 1 total)
  • The topic ‘Deferring Javascript causes plugin to fail’ is closed to new replies.