ASP.NET MVC | Handle onunload event and pressing F5
I have onUnload event handler on my page. Also User can press F5 and reload page. When user pressed F5, The request from browser to server came fuster then request from onUnload. I need that request will come from onUnload then from F5.
onUnload handler
$(window).unload(function () {
var url = '<%= Url.Content("~/Controller/Action") %>/';
var cancelButton = "resetStatus";
$.post(url, { cancelButto开发者_StackOverflown: cancelButton}, function (data) {
});
});
any solutions on this? This is happening in FF only. I have a popup and onunload needs to be called before f5 to clean session variables. but for ff, page load event is called before onunload.
精彩评论