[Resolved] JavaScript Libraries

Home Forums Support JavaScript Libraries

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1067245
    93487u5tr938ouh4trnos8fyoh

    Please update the JS libraries. You can use the slim and minified versions.

    #1067359
    David
    Staff
    Customer Support

    Hi there,

    jQuery is a WP include and is not controlled by GP.
    And GP only requests jQuery if the sticky navigation is enabled, the rest of the theme only uses vanilla Javascript where required.

    #1067364
    93487u5tr938ouh4trnos8fyoh

    Are you sure as I have tried several other themes and it doesn’t happen with the like Astra? Maybe they don’t use jQuery or something?

    #1067365
    David
    Staff
    Customer Support

    jQuery is included in WordPress.
    GP by default does not enqueue it unless sticky nav is enabled.
    If sticky nav is not being used and the request is being made then it will be a plugin or other script requesting it.

    #1067516
    93487u5tr938ouh4trnos8fyoh

    Sticky nav is activated and there are no other plugins other than Autoptimize. WordPress 5.3

    The reason why I care is because it lowers the lighthouse score and Google won’t admit but that is counting against the site.

    I had to use an external plugin to fix that I don’t want to.

    #1067533
    David
    Staff
    Customer Support

    Sticky nav is the last jQuery dependency in the theme – until we find a good replacement that can maintain backwards compatibility it unfortunately must stay.
    The only resolution today is to not use the Sticky Nav – it can be done with CSS ( albeit without transitions ) if you want help with that.

    #1068060
    93487u5tr938ouh4trnos8fyoh

    Regarding CSS, I really prefer to use the regular options of a theme and plugins. When I start adding custom customizations and custom code, it complicates things in future and brings issues. This means I will “stick” the sticky menu as it is intended by your software.

    Regarding jQuery, since I am not a developer, can you please elaborate on the thing. As a search marketer, I do suspect that Google is using Lighthouse scores for rankings, but they won’t admit it publicly. That is why my final goal is to increase the scores there. One of the detected issues, which lowered the scores was the detected outdated jQuery library version which Google claims to have two security vulnerabilities. Some WP claims this is false positive, however I am not concerned weather or not that is a false positive as Google is objectively lowering the score because of this and aslo Google and others doesn’t always say publicly all security issues that they know about. Since WordPress is powering so many sites, I suspect they may be working with someone behind the scenes to resolve the issues without describing them in public. In any of these I don’t actually care about that. I care about the score, right now.

    From my understanding, please confirm if I understand it correctly. jQuery libraries are not within your theme, they are inside WordPress, right? And these WP libraries are used when your theme uses a specific function, right?

    Using jQuery Manager for WordPress and loading jquery-3.4.1.min.js resolved the score. However I don’t want to use a plugin to do this. Does it mean that I have to contact WordPress as their jQuery version is lower than 3.4.1 and they have to update it?

    #1068308
    David
    Staff
    Customer Support

    Correct – jQuery is included within WordPress not the Theme. Whenever a theme or plugin declares a dependency in its scripts the library is loaded.
    WP cannot update to the latest version (3) of jQuery as its not backward compatible and risks breaking a huge amount of sites.

    jQuery Updater or jQuery Manager plugins are the simplest fix. I use the former if required. They only switch the frontend. If you want to try it manually then this stack explains:

    https://wordpress.stackexchange.com/a/257363

    But personally i would just go with the plugin.

    #1068316
    93487u5tr938ouh4trnos8fyoh

    I guess than I have an unfair advantage having that plugin as not many people would know about these scores.

    Thanks, also worried that Google knows about something in relations to security that could expose many WP sites as they suggest two security issues.

    #1068590
    David
    Staff
    Customer Support

    It falls under Best Practice that doesn’t have an impact on performance or UX so i can’t see Google being overly bothered. If it were a ‘real’ security threat then your security plugins would flag and close off the issue.

    But its nice to get those 100 ratings on the report even if some of them are just vanity metrics.

    #1068790
    93487u5tr938ouh4trnos8fyoh

    I’ve done some tests on the subject, an employee of a big company told me “if we tell them we use these scores, everyone would try to achieve top score and it will defy the purpose of the signal.”

    #1194334
    Marcus

    Hi there,

    I am having this issue where I still have Jquery loading but have removed all the components mentioned above. What could be loading it?

    #1194337
    93487u5tr938ouh4trnos8fyoh

    WP Rocket seems to have a feature now to remove jQuery.

    #1194562
    David
    Staff
    Customer Support

    Hi Marcus,

    as per the other topic you would need to disable all plugins to test what is loading jQuery. There is a possibility that your host has installed a Must Use plugin that is calling it.

    If you want to raise a new topic where you can privately share a link to your site, ill take a look to see if there is anything obvious making the jQuery request.

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