Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

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



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Automatically Calling a Function When a Page Ends

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?

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.



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