Hi All,
I am using Build JDEVADF_11.1.1.7.0_GENERIC_130226.1400.6493 version.
I want to know, if there is any way to capture browser close/tab close events..
I read Frank's Post on the same. However this approach is not working for me. And I can't find why......
Following is my jsff code and a corresponding backingBean method having simple SOP. The SOP is printed even when I click on commandButtons and it doesn't print on Tab Close when there are more than one instance of explorer is open in FF
In IE , it doesn't work at all... the SOP is not printed ever....
My JSFF Code :
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1" binding="#{backingBeanScope.Run.d1}" title="Run"
onunload="performUnloadEvent" clientComponent="true">
<af:resource type="javascript">
window.addEventListener('beforeunload',
function () { performUnloadEvent() },false)
function performUnloadEvent() {
var eventSource = AdfPage.PAGE.findComponentByAbsoluteId('d1');
var x = AdfCustomEvent.queue(eventSource, "handleOnUnload",
{ args : 'noargs' }, false);
var y = 0;
}
</af:resource>
<af:serverListener type="handleOnUnload"
method="#{backingBeanScope.Run.onUnloadHandler}"/>
<af:form id="f1" binding="#{backingBeanScope.Run.f1}">
<af:outputText value="outputText1" binding="#{backingBeanScope.Run.ot1}"
id="ot1"/>
<af:commandButton text="commandButton 1" id="cb1"
binding="#{backingBeanScope.Run.cb1}"/>
<af:commandButton text="commandButton 2" id="cb2"
binding="#{backingBeanScope.Run.cb2}"/>
</af:form>
</af:document>
</f:view>
<!--oracle-jdev-comment:auto-binding-backing-bean-name:Run-->
</jsp:root>
My BackingBean Method :
|
public void onUnloadHandler(ClientEvent clientEvent) { |
|
System.out.println("I am closingggg"); |
|
} |
Can anyone please help me to know why its not working ??
And if anyone can suggest some other solution for the same.
Regards,
Neha..