Support » Plugin: Autoptimize » jquery Issue?

  • Resolved willjames

    (@willjames)


    Hi
    The link to show the Youtube video does not work on this page, (link on top of image bottom right). I have tried lots of things, but what seems to work is if I exclude jquery from AO, (or turn AO off).

    This is fine, but then Lighthouse calls me out for render-blocking scripts.

    I am sure that there is a setting that would get the best of both worlds – just not sure what it is!
    Thanks in advance

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Best solution would be for the video-opening JS not relying on jQuery to be honest 🙂

    But if that’s not possible, try changing AO settings to “don’t aggregate but defer” and “also defer inline JS” and then remove existing exclusions unless things break?

    Thread Starter willjames

    (@willjames)

    I have done that (I think) and still not working?

    I now have lots of smaller js files rather than one large one…

    Can’t really change the js relying on jquery.

    Still no video though. 🙁

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Looks like the jQuery-dependant inline JS that adds the event listener is excluded from being optimized (deferred). If you don’t have any exclusions any more in the settings, then it’s the plugin (theme) that is forcing the exclusion somehow in which case I’m afraid you’re stuck .. :-/

    Thread Starter willjames

    (@willjames)

    OK I had not taken out the exclusions – now this seems to work OK, however, Lighthouse is now saying that my javascript execution time is slightly higher than before, but the error message to reduce unused javascript has disappeared.

    I will have to see if the core web vitals in search console approves of the change to multiple js files instead of one large one.

    What’s you experience of this? Better/worse or the same?

    Thread Starter willjames

    (@willjames)

    Unfortunately I have a page that will not load at all with the ‘do not aggregate but defer’ option ticked so had to revert: https://www.truckpages.co.uk/add-a-truck/

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Hmm … what JS error(s) did you see on the browser console while on that page when “don’t aggregate but defer” was active?

    Thread Starter willjames

    (@willjames)

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ah … that’s … ugly. can you check the PHP-errorlog for relevant PHP errors?

    Thread Starter willjames

    (@willjames)

    An odd one – it seems not to be able to download even the favicon before falling over?
    200 GET /add-a-truck/ HTTP/1.0
    302 GET /favicon.ico HTTP/2.0
    51363#0: *250519 open() “/var/www/vhosts/truckpages.co.uk/httpdocs/favicon.ico” failed (2: No such file or directory) nginx error

    Then with AO off:
    GET /add-a-truck/?ao_noptimize=1 HTTP/1.0
    GET /wp-admin/js/editor.min.js?ver=5.8.1 HTTP/2.0
    GET /wp-content/themes/motors/assets/images/checks2x.png HTTP/2.0

    Looks like that admin js file is not being called?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    that’s a consequence of only very little HTML being returned when “don’t aggregate but defer” is active, a pity the PHP errorlog does not show more then that, makes it pretty hard to understand what is going on there.

    I looked at the unoptimized page source and there’s a huge block of inline JS (setting the options object) which, I presume due to the size of it, is killing the “also defer inline JS”-option.

    the easy way out: make sure “Enable configuration per post/ page?” is on, then edit the “add a truck” page and untick “optimize JS” there. that way you can “enjoy” all JS being deferred plus a working “add a truck”-page (albeit the latter not being JS-optimized)?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘jquery Issue?’ is closed to new replies.