Saturday, 15 June 2013

c# - Detect Browser Close on Asp.net -


I want to do some functionality on logout, if the user closes his or her browser directly, then do the same functionality , We can not unload on the page because my website has more than 100 pages because it will work on redirection from each page

thanks

  & lt; Script type = "text / javascript" & gt; Var closing = true; $ (Function () {$ ("A, input [type = submit]"). Click (function () {close = false;}); $ (window) .unlod (function () {if (closing) {Jquery .jax ({url: "http: // localhost: 49591 / account / log off", async: false});}});}); & Lt; / Script & gt;  

When logging out using javascript + jquery, call logout.aspx. Logout. Do whatever you want to do in the ASPX page load event.

The above snippet should be added to the html of your master page.


No comments:

Post a Comment