Hi,
here my working solution for detect when user close browser or a broser tab.
The real trick is to add jquery before load wisej in default.html
in program.vb there is the method BrowserClosed that is called after the closing. Here you can put you code.
in AssemblyInfo.vb uncomment <Assembly: Wisej.Core.WisejResources(“”)> for embedd javascript or put it in initscript.
if you don’t want a message for exit comment this in javascript
window.addEventListener(“beforeunload”, function (e) {
var confirmationMessage = “Exit message”;
e.returnValue = confirmationMessage; // Gecko and Trident
return confirmationMessage; // Gecko and WebKit
});
I hope it is useful for someone, I attach an example project
regards
Cristian Zerbinati
Hi Luca,
mmmhhh right I have used Firefox but Chrome detect refresh.
well at least I can immediately know when the browser or tab is closed 🙂
Hi Christian,
Thank you but… 🙂
Basically it is unfortunately established that it is impossible to detect when the user closes a tab or the browser versus when the user hits refresh or simply navigates or changes the parameters. All browser makers (basically chrome and firefox) have been clear that they do not allow that distinction.
HTH