As i frequently work on Oracle ADF, i've decided to write tips on this Framework.
Previous version of adf (10g) had a <afh:body> component to represent the body of your page which allowed to specify javascript events like onload or onunload.
In ADF RC, the body (as well as html and head) is geneated by a single<af:document>.
Problem is that onunload property is not supported by th af:clientListener. So how do i do ?
Well, a solution is to add this event during page load.
First step :
Embed in your <af:document> the following :
1
| < af:clientListener method = "addOnUnload()" /> |
Second step :
Add your unload event using this kind of script :
1
2
3
4
5
6
7
8
9
10
| < af:document > < f:facet > < f:verbatim > < script type = "text/javascript" > function addOnUnload(evt) { window.onunload=function() { alert('Goodbye Word'); } } </ script > </ f:verbatim > |
When closing browser your event will be triggered as expected.
The alert would fire fine . But lets say I have a usecase where on closing the browser , I need to call a server Listener to execute some custom logic. That doesnot work at all -
ReplyDeletehttps://forums.oracle.com/forums/thread.jspa?threadID=2236455&tstart=0