Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

How can i know when user close the browser.

Not refresh page, not submit or repost - Close Browser ONLY.

Thanks.

Edited by alexk
Posted (edited)

Response to your question.

 

My ASPX application provide interface that allow to users select any Item from table and change his properties. For example: Table contain office workers of my firm. User can select any worker from the list and change his properties. To prevent from another User select the same worker - I'm keep this worker locked for current User by using "http session ID".

When User close the Internet Browser, I can NOT destruct session object and unlock a worker because it is NO *** event fired.

Sorry about my English.

 

[edit]Please watch your language [/edit]

Edited by Robby
Posted

In VBScript, you can use this

 

<SCRIPT LANGUAGE='VBScript'>
Sub Window_onUnload
	msgbox "Unload"
End Sub
</SCRIPT>

 

But you cannot control the browser to remain open.

Posted

Response to your note.

 

I try code from above Post.

The UnLoad event fired when I refresh or PostBack the page.

It's not meet my requirement. I need capture Browser closing event ONLY.

Thanks.

Posted

For your case, I suggest you use "Cookies" rather than "http session". And Cookies will destroy by itself when user close the browser (do not set expires date).

 

So you no need to worry about the browser close event.

 

Is it meet your requirement?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...