WordPress.org

Ready to get started?Download WordPress

Forums

Simple Twitter Connect
[resolved] JavaScript Loading on Every Page (3 posts)

  1. Ryan
    Member
    Posted 1 year ago #

    Otto,
    A quick question...it seems that with STC activated the JavaScript is loaded on every page of the site instead of only the pages that utilize a STC sub-module. Is that the case or am I missing a setting somewhere?

    http://wordpress.org/extend/plugins/simple-twitter-connect/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year ago #

    Yes, that is indeed the case, and it's by design. Browsers do this pretty intelligent thing called "caching", where they save the information from one page to the next. So it really doesn't matter much if all the pages have the twitter javascript code, the code will be loaded from the browser cache.

    More to the point, the twitter code is linked directly to the twitter servers, so it's loading from them, same as it loads for every other website on the internet that has the twitter code on it. So there's a fairly good chance that the users browser already has the twitter javascript in its cache to start with.

    Not the initial loading shiv, mind you, which is different for every site, but the subsequent lazy-loaded code will be much the same and have the same URLs. Same thing happens with Facebook's JS, it loads a short JS file which then loads like 10 others, all of which are basically the same from site to site.

    This is why single-page-testing tools and things like YSlow and such don't tell the whole story. They're only measuring the performance of one particular page load, you really have to see it from a whole-site standpoint.

  3. Ryan
    Member
    Posted 1 year ago #

    That is one great answer and that makes perfect sense. It would be interesting to see some analytics on how many people really do have it pre-cached before they get to our site. As an aside do you know of any way to detect if a cached version is being used (Client side JS library maybe)?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic