Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Defer loading Textpattern form
I have a site that loads map data on certain pages. The map is selected by a tab.
Example page: http://marineweather.net/coastal/boston-harbor-coastal-forecast
Everything on the page loads initially, although the map is not seen by a site visitor unless they click the map tab. The map is a cool feature, but it’s size means that 90% of a page load is loading that map. I’m seeking to make page loads snappier.
The data that creates the map is all on a Textpattern form. It includes js & css & json files. The Textpattern form is useful as there are TXP tags used that make the map unique to every page it is used on. As a result, I’d like to continue to use the form.
Is there a way to delay loading a Textpattern form? A delay of 2 seconds for example would make page loads faster, while still providing the map to those who use it well ahead of when they would likely click the map tab.
Offline
Re: Defer loading Textpattern form
I would create a separate page for the Map tab, but there are also couple other things to consider:
Source code in Boston Harbor Marine Forecast page suggests jQuery library is loaded several times:
First time:
<script type="text/javascript" src="https://code.jquery.com/jquery.min.js"></script>
Second time:
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
Third time, perhaps:
<script>window.jQuery || document.write('<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">\x3C/script>')</script>
Then there are couple fonts that are loaded one by one. They can be smushed together like this:
<link href="https://fonts.googleapis.com/css?family=Oswald:300,400|Roboto" rel="stylesheet">
Offline
Re: Defer loading Textpattern form
Your page speed is not too bad, see the Pingdom Tools report
From that there are a few areas of note, which would probably be better gains than trying to delay Textpattern loading:
- The JSON files from
mwx-13bc.kxcdn.com/jsonpoly/
make up over half the page weight – can you cache those for a certain amount of time (say 5 minutes or preferably more) using a plugin like etc_cache – see how I do something similar to throttle the GitHub API for Textpattern.com here - You seem to be loading two separate versions of jQuery?
- Consolidate Google Fonts into one HTTP request roughly like so:
<link href="https://fonts.googleapis.com/css?family=Oswald:400,300|Roboto:300,400,500,700" rel="stylesheet">
- You may be able to reduce that render blocking 1s wait and load for
mwx-13bc.kxcdn.com
JSON items by preloading?
Offline
Pages: 1