Click here to Skip to main content
15,888,241 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any alternative for onbeforeunload for Chrome..here is my code

window.onbeforeunload = CloseSession;

function CloseSession() {
//log out the user from demand if browser close or alt+f4 is pressed not for back button
if ((window.event.clientY < 0) && (window.event.clientX > 40) ||
(event.altKey == true && event.keyCode == 0))
window.open('LogOffUser.aspx', '_parent', 'left = 9999, top = 9999,width=1px,height=1px');
}
Posted
Updated 7-Jul-14 6:30am
v2
Comments
Sergey Alexandrovich Kryukov 7-Jul-14 11:48am    
This is not C#, this is Javascript.
Why alternative?
—SA

1 solution

This question does not make any practical sense. Whenever you are writing Javascript to be executed in a browser, potentially, it will be executed in any other browser, so finding a solution specific for Chrome, even if it was possible, would not help you much. You need to write compatible code.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900