diff options
author | Brion Vibber <brion@pobox.com> | 2010-12-08 17:39:04 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-12-08 17:39:04 -0800 |
commit | 516161213fd8ebc42332042541e6812466521fe6 (patch) | |
tree | 6772315787f5c1416a4a39a8cac1c404239e11f3 /plugins/Mollom/MollomPlugin.php | |
parent | 26bd15ec0ac50eb80609e3a2c5574c8d7b2eaefa (diff) |
Tweak to PiwikAnalytics plugin to help browsers to pre-load piwik.js, may shave a little off load time.
Piwik's current default recommended JS for loading creates a <script> tag via document.write(). In addition to being generally evil, this means the browser doesn't know it's going to need piwik.js until that chunk of script gets executed... which can't happen until all scripts referenced *before* it have been loaded and executed.
The only reason for that bit of script though seems to be to pick 'http' or 'https' depending on the current page's scheme. This can be done more simply by using a protocol-relative link (eg "//piwik.status.net/piwik.js"), which the browser will resolve as appropriate. Since it's now sitting in the <script> tag, the browser's lookahead code will now see it and be able to start loading it while earlier things are parsing/executing.
May be better still to move to an asynchronous load after DOM-ready, but I'm not sure if that'll screw with the analytics code (eg, not being able to start things on the DOM-ready events since they're past).
Diffstat (limited to 'plugins/Mollom/MollomPlugin.php')
0 files changed, 0 insertions, 0 deletions