Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Active Server Pages (ASP)
Expertise: Beginner
Jul 2, 1999

Automatically Calling a Function When a Page Ends

Question:
Is there any way to call a function automatically when an ASP page ends? I know about Application_OnEnd and Session_OnEnd but isn't there any "Page_OnEnd" function or some way of simulating it?

Answer:
The key here is what you mean by "when an ASP page ends." If you are talking about server-side processing, just place your code or a call to your function at the very bottom of your page. Assuming that there is no other branching, it will be the last piece of code to be executed before the server ends processing your page.

If you are talking about code to be executed when your site visitor leaves your HTML page, then put a call to your CLIENT SIDE JavaScript, JScript or VBScript code in the ONUNLOAD event of the body tag, such as this:



DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date