Posts Tagged ‘deferred load’

Problems with deferring the JavaScript

Just a heads up for anyone running the deferred JavaScript plugin that I’m using on this blog. I’ve been running it on some of my other sites to improve the page load speed but it is a little bit fiddley.

So, on one of my other sites, I have a little more content and some additional features that are controlled via plugins. Some of these plugins inject some JavaScript into the page that relies on jQuery, but as I’m deferring the loading of jQuery, the inline scripts fail and throw errors saying that jQuery is undefined.

A bit annoying really, but not unexpected. So that’s the next challenge, either finding some better plugins that don’t rely on jQuery for simple things that vanilla JavaScript could quite easily do itself without a stupid dependancy, or work out a better way to defer the JS in a nicer way.

As with all of the work I’ve done on this blog so far, I want to do it without having to actually right a lot of code so it’s the type of thing anyone can do for their own blog as I know that not everyone is interested in using a lot of custom code.

If anyone has already taken on this challenge, let me know. Maybe we could come up with a post on solving it together.