1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Problem with calling JavaScript from a remote site

Discussion in 'Scripting & Programming' started by tripwire45, Mar 26, 2008.

  1. tripwire45
    Honorary Member

    tripwire45 Zettabyte Poster

    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:
    <script type="text/javascript" language="JavaScript" src="http://www.hebcal.com/etc/hdate-en.js"></script>
    <h3><a name="localtime"></a>Shabbat Candle Lighting and Havdalah Times for Boise</h3>
    <script type="text/javascript"
    <!-- 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.
    Any ideas?

    Certifications: A+ and Network+
  2. ThomasMc

    ThomasMc Gigabyte Poster

    have a look here(Run with it and scroll down), am sure you should be able to implament this yourself 8)
    Certifications: MCDST|FtOCC
    WIP: MCSA(70-270|70-290|70-291)
  3. Mitzs
    Honorary Member

    Mitzs Ducktape Goddess

    Trip, the Hebcal Interactive Jewish Calendar and the 1-Click Shabbat Candle Lighting Times that I found here are both under the Creative Commons license. It allows you to copy it to your website.


    Look at the bottom of both of these pages.


    Certifications: Microcomputers and network specialist.
    WIP: Adobe DW, PS

Share This Page