I created and support the website for my congregation. As part of the site, I wanted to display the Jewish as well as the "regular calendar" and candle lighting times for the Sabbath. I found a site that allows anyone to use their JavaScript calendars and add them to their websites as long as credit is properly given (which it has).
I've never had a problem with it before until the other day. Apparently, the server hosting the required JavaScript was down and the result is none of the pages on my site that uses that code (just about all of them do) would load. The pages parse from top to bottom, so the minute a browser tried to parse the section with the required JavaScript, the remote server was accessed...only this time because that server was apparently down, the information couldn't be retrieved.
The result is that my page wouldn't load any more than the section containing the code that called the calendar information. I was stuck.
The remote server is up again but I was wondering if there was a way to write something in JavaScript that said something like:
If this information isn't retrieved in 20 seconds (or whatever), ignore it and proceed with parsing the rest of the webpage.
I know what you're thinking. You're thinking "why not just copy and paste the required JavaScript onto the web server hosting my site so it'll all be local?" As I recall, that's not part of the licensing agreement for using this code. Yes, that would be the easiest thing to do, though.
Here are the two sections of JavaScript from my index page that require access to the remote server:
Code:
<script type="text/javascript" language="JavaScript" src="http://www.hebcal.com/etc/hdate-en.js"></script>
Code:
<h3><a name="localtime"></a>Shabbat Candle Lighting and Havdalah Times for Boise</h3>
<script type="text/javascript"
src="http://www.hebcal.com/shabbat/?geo=zip;zip=83706;m=44;cfg=j">
</script>
<noscript>
<!-- this link seen by people who have JavaScript turned off -->
<a href="http://www.hebcal.com/shabbat/?geo=zip;zip=83706;m=44">Shabbat
Candle Lighting times for Boise, ID 83706</a>
courtesy of hebcal.com.
</noscript>
Any ideas?
Thanks.