Hi,

I want to destroy session when user close the browser tab or window in PHP. Please give me sample code.


Thanks in advance.

William

Load some PHP script at the time of onunload event using ALAX.Use session_destroy function to destroy the session.

Do you have any sample ajax code

@divya: i don't think you can get browser close event.
It works only on some browser, i have tried it in past.
If your code works in all browser post here for others use.

commented: Yes +5
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.