Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
12-04-2012, 08:02 PM #1
- Join Date
- Nov 2011
- Thanked 0 Times in 0 Posts
All works 'okay' most of the time and I am fairly happy with it but with two exceptions.
Once a day my supplier updates their inventory and their server is down for 5-30 minutes in the early hours of the morning (UK time). The problem is that my website therefore cannot load the script and the rest of the page won't load until such time as my supplier's website is back online. We have customers world-wide so it isn't ideal as 2.00am UK time obviously isn't the case elsewhere in the world.
Also the loading of the search box can at times delay the loading of my webpages (the search box is on a number of pages).
Thanks for any advice...
12-04-2012, 09:13 PM #2
- Join Date
- Jun 2002
- London, England
- Thanked 2,555 Times in 2,533 Posts
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
Last edited by Philip M; 12-04-2012 at 09:18 PM.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
12-04-2012, 09:20 PM #3
If the inventory is "loaded" using an AJAX call, you can control the AJAX timeout and, upon that timeout, do the same thing Philip showed.
But Philip's answer is a pretty good generic one. Even if the variable is defined, if it doesn't have the value or kind of value you are expecting, you can use that same basic pattern.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
12-04-2012, 10:01 PM #4
- Join Date
- Jun 2007
- Thanked 598 Times in 578 Posts
you can add the defer or async attribute to the script tag so that your page does not wait on the script to load before rendering the html.
visually, you want to use HTML and CSS to indicate to all users every time that the script is "loading". after ten seconds, you tell them that it is "unavailable", and when the script arrives, it replaces the "loading"/"unavailable" text with the data/functionality provided by the script, intuitively replacing the message with functionality.
a <progress></progress> usually looks good in those kind of empty containers...