JS loads every page on the site - can we just load JS where needed?

edited March 2015 in Questions
I have been taking a close look at our (wordpress) site performance lately. We use OneAll to enable social login and registration. Great product!
I note there is a Oneall JS that loads on every page:
URL: http://[myacct].api.oneall.com/socialize/library.js
Host: [myacct].api.oneall.com

This adds 0.3 seconds to every page load, including the homepage. Is it necessary - can we remove from the homepage and add the JS just to the pages where we actually use Oneall, such as login?

Thanks
Brian

Answers

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    You can simply enable the asynchronous Javascript in the plugin settings. This will load the JS in the background! The JS should also only be loaded once and then served from the browser's cache. We have however planned to improve the plugins so that the JS only loads where necessary.
  • Hi
    I tried the async mode, it does help but yes long term it would be good to only load where needed especially when it's 2 pages out of 2,000. I will look for a third party plugin to allow control or suppression over individual elements in a page load, there are plenty of other things loaded that are not used on every page - the home page of course being the most important.
    Thanks for the response!
  • Hmmm... This is proving difficult to disable on the home page. Have you not used:
    wp_register_script()
    wp_enqueue_script()
    - is that part of the future plan!
    Thanks

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.