As everyone may known. Regular PrimeFaces-13 Ajax framework not support page level event such as “unload” or “beforeunload” when user is leaving current page in browser.
my javascript as:
<h:head>
<title>Customer Details View</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<script type="text/javascript">
$(window).unload(function () {
$.ajax({
type: 'GET',
async: false,
url: '#{customerSWController.leavingCustomerView()}'
});
});
</script>
</h:head>
in my xhtml file
I’m trying to use header javascript to catch page “unload” event and then call my JSF backend bean method such as: #{backendController.leaveViewPage()} that I did it in p:ajax tag.
but unfortunately, I never get it works.
Any one have idea, please let me know.