Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onload

Status
Not open for further replies.

DaneshD

Programmer
Dec 10, 2004
19
SE
Hi all,

I have an event handler triggered on "onload" event. The problem is that it is not fired when the page is not successfully loaded and will work only and only when the page is successfully loaded. Can anybody help? I need it to get fired no matter if the page is successfully loaded or not loaded because of time out or anything else.

Thanks
 
1. What does your onload event do
2. Is it 100% required that the page is loaded (i.e. does it depend on other elements on the page)


--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 

1. Well, my unload event is triggered to refreshing the page.
2. Absolutely not. Sometimes it happens that the page is not completely loaded due to network problems which causes time out.

I would like my script to run no matter if the page is loaded or not. I googled about it, but didn't find appropriate answer. Hope to get help here.

Thanks,

D.
 
I think we need a bit more information, because the information you have given us makes your page seem almost redundant:

- The 'onload' event refreshes the page.

- The refresh doesn't actually need to wait for the page to load before going ahead.

This being the case, you could put your refresh code anywhere on the page, but users would probably never see any data of note because the page would constantly be unloading and loading again too quickly for them to read.

This is why I think you should give us more information as to what you actually want to achieve.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 

Hi,

The code which has been triggered to "onload" event, will be fired only and only if the page has been successfully loaded *or* even if it is in the middle of loading process. It will not fired if the loading process has been failed due to low speed of internet connection or any network impairment. My main intention is to provide a service so that users will be able to refresh an address on a time basis. It has happened that the code stopped refreshing for many users because the page was not loaded correctly e.g. time out error. I will appreciate for your solution.

Regards,

D.
 
Why use Javascript? Why not just use a META refresh?

Content = number of seconds to refresh the page. Place it in the <HEAD></HEAD> of your document.

Code:
<meta http-equiv="refresh" content="5" />


--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top