Jump to content

on window close execute php statement


hassank1

Recommended Posts

it seems like you could...

<script>
window.unload=closeFunction();

function closeFunction(){
    //AJAX request to trigger PHP script
    //possibly add something to a database that a cronjob will check periodically
}
</script>

 

On a more basic level, hassank1, what are you trying to accomplish?

 

A long time ago, I attempted to use an onUnload event to send a http request (not using the XMLHttpRequest object) and I was able to get IE to send it but not FF.

 

Has anyone recently attempted actual code using AJAX to send a http request due to an onUnload event? If it works, I'm going to guess it is going to be browser specific.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.