Welcome to WebmasterWorld Guest from 50.16.24.12

Forum Moderators: open

Using body onLoad event

..but with reference to external .js script

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

10+ Year Member



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)

10+ Year Member



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)

10+ Year Member



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

10+ Year Member



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

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved