I have a simple website which makes a little use of jquery but it is not essential so I would like to skip the jquery download if the users connection is slow.
Ideally I would detect a slow connection but I suppose detecting a mobile phone might be a reasonable proxy for this.
If this is possible I would then remove the parts of the page which use jquery and add them dynamically if jquery is loaded.
Options I have considered are:
- Test the connection speed by downloading a small image
- Download jquery but timeout after a second or so (I searched for cancelling downloads but found nothing)
- Drop jquery all together and just write the javascript I need (I'll probably get it wrong for some browsers though)
- Wrap the jquery download in some javascript which checks the useragent for andriod or iphone
- Try to use css media selectors to control the jquery download
but I am not sure which to persue.
Also, I can't use server side tricks as it is a static page (to avoid the appengine cold start issue).