Hi,

On google Chrome there is an event when someone closes the window that merely asks if you really want to leave ONLY.
What i wanted was to know if there is a way in jquery or javascript that enables the logout code to be run on chrome,(or any other way to turn around this problem)
Because in mozilla firefox and internet explorer there is a way to run that code, (the logout code).

Any help will be sincerely appreciated,

the code that i use is this(javascript):

<script type="text/javascript">
  window.onbeforeunload=function (evt){//logout code}
</script>

and it only doesnt work in google Chrome

Recommended Answers

All 4 Replies

Thanks a lot it really works.

One more question:
How do i differentiate when a page is refreshed from a page/browser closed?
Because it seems that the onbeforeunload event is triggered when a page is refreshed also, and i didnt want that to happen ?

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.