Inkove method after close window with unload

Hi guys,
I'm trying create a way the invoke a method in a BackingBean after close the window of browser for this I'm using the event unload of 'af:document'.
I used the Frank's sample ( http://blogs.oracle.com/jdevotnharvest/entry/responding_to_the_page_unload_in_a_managed_bean ) but it doesn't work.
Can anybody help me?
I'm using JDeveloper 11.1.2.0.0
This a part of my code :
Page
<f:view afterPhase="#{backingBeanScope.backing_mainPage.afterPhase}"
          beforePhase="#{backingBeanScope.backing_mainPage.beforePhase}">
    <af:document id="d1"
            binding="#{backingBeanScope.backing_mainPage.d1}"
            title="CTBC - Algar Telecom"
            smallIconSource="imgs/favicon.png imgs/favicon.ico"
            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", {}, true);
              var y = 0;
    </af:resource>
    <af:serverListener type="handleOnUnload" method="#{sessaoLogoff.onUnloadHandler}"/>
      <af:form id="f1" binding="#{backingBeanScope.backing_mainPage.f1}">
.ManageBean
public class ControlaLogoff {
    public void onUnloadHandler(ClientEvent clientEvent) {
        System.out.println("good bye");
}Regards,
Renan

I just tested the code Frank provided (as is) and it worked for me. the only thing to mention is when I closed browser completely the bean isn't called. If I close the tab running the page all works as expected.
I strong feeling is that you simply can't catch the event if someone closes the browser (or use task kill). So if that is what you need you are out of luck.
Again, the other case works for me. So if it's not working for you I guess there is some kind of coding error in your app.
Timo

Similar Messages

  • Invoke a method when Close Window is clicked

    Hi,
    How do i invoke a method when "close window" on the global button bar is clicked.
    Can someone please help.
    Thanks in advance.
    Pavan
    Edited by: user12215240 on Feb 23, 2010 9:32 AM

    Is it possible to change the settings so that when the red 'close' button is clicked, the application will hide instead of closing?
    Applications don't "close," windows do. If you are just closing windows but not quitting applications that opened them, it is no wonder that there are hundreds of apps in the Dock.
    A few apps like System Preferences have only one window, so they automatically quit when you close that one window. Most apps do not do this: even after all their windows are closed, they remain running & thus show up in the Dock, in Activity Monitor, & so on. They each require a little (or sometimes more than a little) real memory reserved for their use to remain running -- this subtracts from what is available to do useful tasks, & will slow down your Mac when it results in too much virtual memory use.
    Thus, it is a good idea to quit applications you don't have an immediate need for, especially if they don't require long startup times. If you want easy access to select applications, create a folder & fill it with aliases to those apps, then drag that folder to the right side of the Dock, where it will create a stack. When opened, the stack will allow one click launching of those apps.

  • When i close window with multiple tabs angd start new session (open new window) old tabs open again, how can i stop it?

    when i close window with multiple tabs and start new session (open new window) old tabs open again, how can i stop it?

    It is possible that there is a problem with the files [http://kb.mozillazine.org/sessionstore.js sessionstore.js] and sessionstore.bak in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder]
    Delete [http://kb.mozillazine.org/sessionstore.js sessionstore.js] and sessionstore.bak in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder]
    * Help > Troubleshooting Information > Profile Directory: Open Containing Folder
    If you see files sessionstore-##.js with a number in the left part of the name like sessionstore-1.js then delete those as well.
    Deleting sessionstore.js will cause App Tabs and Tab Groups to get lost, so you will have to create them again (make a note).
    See:
    * http://kb.mozillazine.org/Session_Restore

  • Error after close popup with swfloader

    Hi all, hope some one could help me with this i get this
    error ( Error: Unable to load '' ) each time after i close a popup
    with a swfloader the error popsup when i click on the datagrid
    *****************************main mxml
    private function ShowPano():void
    var SWFLoaderInstance:Panoramica2 =
    Panoramica2(PopUpManager.createPopUp(this,Panoramica2,true));//
    instantiate and show the title window
    PopUpManager.centerPopUp(SWFLoaderInstance);
    SWFLoaderInstance.mainAppPano = this //Reference to the main
    app
    scope
    *******************************this is the mxml Panoramica2
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="doInt()"
    cornerRadius="10" width="600" height="450">
    <mx:Script><![CDATA[
    import mx.controls.PopUpMenuButton;
    import mx.managers.PopUpManager;
    import mx.collections.ArrayCollection;
    import mx.controls.Button;
    [Bindable]public var mainAppPano:Object = null;
    //called by the close event raised byclicking the close
    button
    private function closeWindow():void
    PopUpManager.removePopUp(this);
    }//closeWindow
    private function doInt():void
    PopUpManager.centerPopUp(this);
    ]]>
    </mx:Script>
    <mx:TitleWindow layout="absolute" right="10" left="10"
    showCloseButton="true"
    close="closeWindow()" top="10" bottom="10">
    <mx:SWFLoader
    source="{mainAppPano.datagrid.selectedItem.pano..src}"
    scaleContent="false"
    horizontalCenter="0" verticalCenter="0"/>
    </mx:TitleWindow>
    </mx:Canvas>
    ********************************xml structure
    <catalog>
    <libro>
    <name><![CDATA[<b>Biblioteca Central
    </b> ]]></name>
    <desc><![CDATA[Se inauguró el 20 de noviembre
    de 1978 ]]></desc>
    <imagen>FOTOS/est/Biblioteca Central Manuel Bartlett
    Bautista.jpeg</
    imagen>
    <pano nombrePano="Biblioteca Central Bautista">
    <src>FOTOS/Panoramicas/PanoZoom642007.swf</src>
    </pano>
    <ico>BOTONES/gifs/video.gif</ico>
    <video nombreVid="Biblioteca Manuel Bartlet">
    <src>VIDEOS/Biblioteca Manuel Bartlet.flv</src>
    </video>
    <audio/>
    <pie>Biblioteca Central Manuel Bartlett
    Bautista</pie>
    </libro>
    </catalog>

    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    window.close();
    window.opener.doSubmit('REFRESH');
    </script>javascript does not wait for the current action to complete and then perform the next line.
    means in your function call
    doSubmit('SUBMIT');is triggered and it carry on's to next line that is
    $x('P7_FLAG').value;this will not be set because you are setting the value of P7_FLAG to 1 in plsql and trying to check in javascript, which will not work.
    what you need to do is amend your js function like below
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    </script>create a page branch to procedure and make it conditional to when P7_FLAG = 1
    and set the branch source to below
    htp.p('window.close();');
    htp.p('window.opener.doSubmit(''REFRESH'');');

  • Close Window (with O/P) out of IFrame

    Hi experts,
    I did create a new component (with bsp_wd_cmpwb) and therein a window.
    In this window I call an IFrame which is another BSP-Application.
    Now I would like to close this window out of the iframe.
    I did already create an O/P to close the window, but I don't know how to start the method in IFrame to do this.
    Just at opening the window SET_VIEW_GROUP_CONTEXT and DO_FINISH_INPUT are run-through.
    If I can force a run to this methods out of the IFrame it would be also ok for me, because therein I can fire the O/P.
    The closing with the O/P works fine, but I need to trigger/force it.
    First I tried to close it with the following jscript, but it doesn't work in firefox.
    <SCRIPT LANGUAGE="JavaScript">
        function closeAndRefresh(){
          opener.location.reload(); // or opener.location.href = opener.location.href;
          window.close();
        javascript:window.close();
              </script>
    Thank you for every help.
    Kind regards

    Does nobody have an idea regarding this?

  • Prevent close window with Tabs present hack?

    I can't seem to find the reference but I came across in the last month or so, a hack/mod/script that prompted a dialogue box to pop up if you ask Safari to close a window while there are other tabs present. Does anyone know of this too? I'm hoping it will work as well when you accidently hit Command Q when you are meaning to hit Command W. (I lost the dozen or more pages of interest out of a recent 50-80, after hours of research) I guess another option would kill the Command Q stroke in Safari, but I'm not sure if it is a global thing or not.
    I'll of course make the suggestion to Apple, but in the mean time any ideas?

    Hi John,
    Have a search for Taboo at macupdate.com. That will give you a warning when you try to close a window with several tabs on it.
    For command-Q remapping, have a read of this:
    iBod, "changing the default shortcuts ?" #2, 12:24pm Sep 30, 2005 CDT

  • Adobe photoshop cc 2014 won't close window with unsaved file

    Recently installed update to Photoshop via creative cloud. Photoshop works great but for some reason I am unable to close a window with an unsaved project. Pressing command-w or going to file close doesn't do anything. As soon as I save the file I can close the window or quit photoshop. Is this in the preferences? Please advice.
    thanks

    I'm having this same issue.  Can't close an unsaved file that has been opened, even if it is completely unedited.  When an unsaved file is present, I can't quit Photoshop, either.
    I'm on OSX 10.7.5  (yes, I know...it's aged), Photoshop CC.  Plenty of memory and disk space, so that's not the issue.
    Any ideas?  Thanks!

  • Problem on early 2009 iMac with OS 10.5.8 500gb hdd after uninstalling Windows with boot camp there is still no more disc space available

    I had a partioned HDD 250 gb Mac and 250 gb Windows. I have uninstalled Windows with boot camp but still dont have the extra 250 gb available. What to do now?

    You need to remove the partition you created when you set up BootCamp.
    http://www.macworld.com/article/1156195/delete_boot_camp.html

  • Netscape crash when close window with applet

    I am using JDK1.1 and swingall for load JApplets in Netscape without plugin. Sometimes when I close the window where the applet is, netscape crashes.
    I read that could be a problem of memory when the destroy method is called. Can be other reasons, and if it is a problem of memory how can I avoid it ?
    Thanks,

    Try using Netscape v6.0. Earlier versions have already reported having problems with Java Applets. Hope this would help.
    Ashish

  • How do i change the setting so that when i close windows with multiple tabs, they will ask questions ' save pages' or 'quit' or 'cancel'.

    I really need help with this cause when im using firefox 3.6 , usually when i want to close the window , they will ask me whether i want to save the tabs or close or cancel.. but im having difficulties with firefox4.
    and now i need to type again the last tab page which i went to.its kinda troublesome.
    really need help for this.

    Firefox now always stores the old session, and you can access it by going to the History menu and selecting "Restore Previous Session"
    If you want Firefox to display the message to save the session, it can be turned back on by changing some preferences.
    # Type '''about:config''' into the location bar and press enter
    # Accept the warning message that appears, you will be taken to a list of preferences
    # Locate the preference '''browser.tabs.warnOnClose''', if its value is set to '''false''', double-click on it to change its value to '''true'''
    # Repeat this for these 3 preferences '''browser.warnOnQuit''', '''browser.warnOnRestart''' and '''browser.showQuitWarning'''
    If you always open the last set of tabs, an alternative approach is this:
    # Click the orange Firefox button, then select options to open the options window
    # Go to the General panel
    # Change the setting "When Firefox starts" to "Show my windows and tabs from last time"

  • Laptop keeps booting up after Reinstalling Windows with Recovery Disks

    My hard drive died. I replaced it and reinstalled windows using the recovery disks that came with it.
    After a successful installation (formatting the drive, installing software in 3 CDs) the computer keeps rebooting endlessly. The reboot process never leaves the intial TOSHIBA screen that access the CMOS therefore windows never starts.
    What is wrong? 
    Thanks in advance....
    Laptop: 2430-S255, Windows XP Pro, BIOS V1.6  
    Solved!
    Go to Solution.

    I got it to work..... The solution: Even though I was not getting any errors during the recovery (only when rebooting after the install) I read about issues with the software recognizing the computer as the one entitle for that installation. I downloaded the "DMI Update Utility" installed it and reinstalled the software again from the recovery CDs with no issues this time..... Thanks for your interest Techman....

  • Close window with a keystroke?

    Is it possible to close out a window using a keyboard shortcut? also for that matter is there a list of keyboard shortcuts for Leopard?

    Gothboy wrote:
    Is it possible to close out a window using a keyboard shortcut?
    how about _*Keyboard Maestro*_ ?
    also for that matter is there a list of keyboard shortcuts for Leopard?
    click here for information.
    JGG

  • How to go back and forth between my windows and Mac after installing windows with boot camp?

    Im in my Mac and I want to go back to my windows but dont know too.

    Restart with the Option key held down, or use the Startup Disk pane of System Preferences, or the Startup Disk control panel in Windows.
    (124963)

  • After restoring Windows with HP Recovery Discs Only 76gb of Hardrive is available

    With Disk management if shows:
    200mg unallocated/C:76GB NTFS (Healthy(boot,page file, Crash dump,Partition)/SDV 400MB FAT32 (Health system,active primary part)/398GB Unallocated.  C: Simple basic NFTS 76GB and SDV simple basic FAT32 396mg. And 390 GB unallocated? How do I get the 390GB dedicated to Volume C:? A display of computer shows only C: with 75.9GB with only 16.7GB free. No other drives
    This is a 500GB Hard Drive.  
    HP Support Assistant shows disk drive 1 is 465.76 model ST9500420ass SMART Staus as GOOD and a volume C\: size 76GB 16.8GB free

    I knew that I would end up having to order the discs from HP!
    The logic of computer manufacturers' escapes me. The recovery console has the option of making back-up discs -- this is convenient for the user. It doesn't work properly for no apparent reason -- this is an inconvenience. And only one set can be made. Aren't these things supposed to be thoroughly tested before the products ship? 

  • How do i access osx after using windows with boot camp

    I just got a new macbook pro and i have never used boot camp.  well i loaded windows 7 using boot camp and now I dont know how to get back to osX.  Can anyone help?

    lathscope,
    do you notice a little triangle on the bottom right corner of your screen - near the clock (in Windows)? If you do so, click on it. Shoud appear an option to restart the computer in Mac OS.
    Other option is to go to the Control Panel. There is a icon for Bootcamp there.
    Joster

Maybe you are looking for

  • How to move my iMovie project?

    How do I move my iMovie project (not the .mov file) to another Mac computer so I can edit it on receiving computer?

  • Now here is the story: gmail vs iCloud

    There must be a way to manage the following problem (Dell W7 top of the range, iPhone 4S 16 and iPad 2 64: 1. I imported all my Outlook contacts to Google contact, mainly to be able to get rid of duplicates and merge mail accounts that were double bu

  • Error after updating my nokia 5230

    Hi this is bobby i recently updated my nokia 5230 with the latest update.After update i having i found my message in box is showing wrong timeing plz suggest me how can i correct the error

  • How could I know whether Microsoft patch need reboot or not ?

    We use win2003R2 and win2008R2 and so on in the domain environment. When we apply the Microsoft-provided patch, is there any way to know it need OS reboot in advance ? 

  • Full Guide: How to convert any DVD and videos to iPod Touch/Classic/Nano

    This full guide includes four parts. (1) How to Crack DRM video and audio files (2) How to Rip a DVD to put it on iPod/iPhone 3G/PSP/Zune/Sansa View/iRiver…… (3) How to convert and burn WMV/AVI video directly to DVD (4) How to transfer video/music fr