Setting timeout on external javascript

@

-@-

Hi there All,

Don't know if this is possible at all, but here goes.

I've got a page (an active server page if that makes any difference), that
is pulling some sticky content from www.freesticky.com using the following
code:

<script type="text/JavaScript"
src="http://www.freesticky.com/stickyweb/syndicate/otd_events_hlines.asp"></
script>

The problem is that occasionally www.freesticky.com is unavailable, and so
is the stuff I'm trying to display. This in turn causes my page to hang.

Is it possible to set some kind of timeout, or something that will allow my
page to complete loading even if this stuff is not available.

Any help you could offer would be major cool.


Thanks,

@ndyB
 
G

Grant Wagner

-@- said:
Hi there All,

Don't know if this is possible at all, but here goes.

I've got a page (an active server page if that makes any difference), that
is pulling some sticky content from www.freesticky.com using the following
code:

<script type="text/JavaScript"
src="http://www.freesticky.com/stickyweb/syndicate/otd_events_hlines.asp"></
script>

The problem is that occasionally www.freesticky.com is unavailable, and so
is the stuff I'm trying to display. This in turn causes my page to hang.

Is it possible to set some kind of timeout, or something that will allow my
page to complete loading even if this stuff is not available.

Any help you could offer would be major cool.

Thanks,

@ndyB

You can try setting DEFER on the <SCRIPT> tag:

<url:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/defer.asp
/>

However, be aware that even if it works in a browser [1], it may produce other
errors if code in your own page relies on code that is defined in the file you
are sourcing for the script tag. I believe there's more to the use of DEFER, I
seem to recall some discussion about it here in the recent past, you might find
more information at <url:
http://groups.google.com/groups?q=s...F-8&group=comp.lang.javascript&sa=G&scoring=d
/>.

Also, there's no guarantee it will prevent the browser from stalling if the host
from which the SRC is being loaded is unavailable, although it probably should.


[1] note what it says at <url:
http://www.w3.org/TR/REC-html40/interact/scripts.html />
defer [CI]: When set, this boolean attribute provides a hint to the user agent
that the script is not going to generate any document content (e.g., no
"document.write" in javascript) and thus, the user agent can continue parsing
and rendering.

The operative words in that explanation are "hint to the user agent".


--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 
K

Kien

Hi,
I would stick that script link onto another file then use iframe or something
to show it on your site.
Kien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top