Welcome to WebmasterWorld Guest from 54.196.243.192

Forum Moderators: open

Message Too Old, No Replies

Using body onLoad event

..but with reference to external .js script

     
2:50 pm on Dec 3, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Aug 21, 2000
posts:273
votes: 0


I have a simple page which creates a form and then immediately posts itself to another page, passing the formatted data across.

This page currently works very well, and I can't really its functionality.

I now need to pass some of the data to a third party site, and I'm aiming to do this by passing the data as parameters in a url. I will make the call to the url by calling an external JavaScript file.

This works fine, and passes the data across without a problem. However, I'm worried that if the third party site goes down, my page will not redirect as the onLoad event will take ages to trigger.

Passing the data is secondary to preventing my site from breaking.

I also considered calling a gif, but then the onLoad will still be waiting... any ideas?

3:16 pm on Dec 3, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 27, 2002
posts:125
votes: 0


Would this work?

<SCRIPT>
function passParams{
var testImage= new Image();
testImage.onload = function(){//pass the params}
testImage.onerror = function(){//dont pass params }
testImage.src = 'http://testServerAlive.com/theImage.gif';
}
</SCRIPT>

<BODY onload=passParams() ..

3:18 pm on Dec 3, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Aug 21, 2000
posts:273
votes: 0


Hmmm... I like it... I'll give it a go.
3:38 pm on Dec 3, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Aug 21, 2000
posts:273
votes: 0


Looks to be working. Nice one, thanks a lot.