PS2-Calling an ActionListener on browser window close using JS eventQueuing

Hi ,
I need to call an Action Listener(to do some post processing) when a browser window is closed.
To achieve this I am using the ADF Javascript APIs.
I tried the following but neither worked :(
1)Having the following JS code directly in my jspx page -
<af:resource type="javascript">
window.onunload = function(evt){
var button=AdfPage.PAGE.findComponentByAbsoluteId("button"); /** Getting the Abs Id of a button which has the needed ActionListener attached to it */
AdfActionEvent.queue(button,true);
</af:resource>
2)Have a clientListener under the af:Document with type as "load" which calls a JS method as below
<af:resource type="javascript">
function onLoad(evt){
window.onunload = function(evt){
var button=AdfPage.PAGE.findComponentByAbsoluteId("button");
evt.cancel(); /* trying to make sure that this doesnot get propagated to the server*/
AdfActionEvent.queue(button,true);
</af:resource>
3) Having a clientListener call a JS method which queues a Server Listener to call a Action Listener.
window.onunload = function (event){
var source = event.getSource();
AdfCustomEvent.queue(source,"serverListenerMethod",{},false);
Also client attribute for the "button" is true.
I am making sure the code is put under metaContainer tag of the af:document
Thanks

Yes I had tried that .. the alerts fire fine as mentioned in my previous posts too ...
But the issue here is to call a server Listener which will call some bean code for some logic when a browser window is unloaded /closed!
As per Frank's post this is not possible using a simple clientListenr as -
"the browser native JavaScript unload event itself is not very helpful to send an event to the server using the af:serverListener tag. The reason for this is that when the unload event fires, the page already has been unloaded and the ADF Faces AdfPage object needed to queue the custom event already returns null. "

Similar Messages

  • Browser window close

    If a form is running through a browser, how can the developer ensure that whan a user closes the browser, and so bypasses an application shutdown button, all correct application close functionality is handled.

    Facing this exact issue ..
    Here are the other things that I tried.
    Can someone please help ?
    PS2-Calling an ActionListener on browser window close using JS eventQueuing

  • Why do i keep having java script application error "on HidePage called" everytime i launch, browse and close Firefox?

    why do i keep having java script application error (on HidePage called) everytime i launch, browse and close Firefox?
    == URL of affected sites ==
    http://
    == User Agent ==
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4

    Hello Bo.
    It's possible that you are having a problem with some Firefox add-on that is hindering your Firefox's normal behavior. Have you tried disabling all add-ons (just to check), to see if Firefox goes back to normal?
    Whenever you have a problem with Firefox, whatever it is, you should make sure it's not caused by one (or more than one) of your installed add-ons, be it an extension, a theme or a plugin. To do that easily and cleanly, run Firefox in [http://support.mozilla.com/en-US/kb/Safe+Mode safe mode] (don't forget to select ''Disable all add-ons'' when you start safe mode). If the problem disappears, you know it's from an add-on. Disable them all in normal mode, and enable them one at a time until you find the source of the problem. See [http://support.mozilla.com/en-US/kb/Troubleshooting+extensions+and+themes this article] for information about troubleshooting extensions and theme and [https://support.mozilla.com/en-US/kb/Troubleshooting+plugins this one] for plugins.
    If you need support for one of your add-ons, you'll have to contact its author.

  • If I have multiple browser windows open (not tabs, windows) and I close 1 of them, why do ALL browser windows close?

    If I have multiple browser windows open (not tabs, windows) and I close 1 of them, why do ALL browser windows close?

    How are you closing the window?
    Are you using the File menu or the close X on the title bar?
    Use Alt + F to open the File menu with the Close Tab entry visible (doesn't work with the mouse).

  • Whenever I open new tabs Firefox crashes and the browser window closes automatically.what will I do?

    I am facing this problem since a month.I never faced this problem before.I always feel good to use Mozilla Firefox as my browser.I used to open multiple tabs in a same browser window.For example- in a tab I logged in to Facebook,at same time I might be downloading songs or something else or open another site in the other tab.It might be 2 or 3 tabs sometimes.But now a days,I am facing the problem whenever I open multiple tabs.Its unusual and so much annoying.The Firefox crashes and the browser window closes showing a messege to send an error report.Please Help me.
    N.B. - I am using the Windows service pack 2.
    RAM - 2 GB
    Hard disk MEmory - 250 GB.

    I had this same problem. Seems to be caused by the web developer tool bar FF extension (this started happening after a recent update to that extension). After disabling it, my FF is back to normal :)

  • Any way to open new browser window without using image maps?

    Is there any way to open new browser window without using image maps? My code works fine in Firefox, but not in IE. There are 2 problems in IE: 1st is that the thumbnail images move up within their own borders & 2nd that when you click on an image it does open up a new browser window, but also redirects to the index page (in this case it's just a placeholder index page - the new one I've called index_new.html for the time being).
    Here is the link:
    http://www.susieharperdesigns.com/gallery_beads.html
    Any help is greatly appreciated.

    Your missing a value on the HREF.  In your code you have this:
    <area shape="rect" coords="-24,-9,106,144" href=" " onclick="MM_openBrWindow('gallery_bead1.html','','width=255,height=360')" />
    </map></div>
    and it should be this:
    <area shape="rect" coords="-24,-9,106,144" href="javascript:void()" onclick="MM_openBrWindow('gallery_bead1.html','','width=255,height=360')" />
    </map></div>
    If you fix the code on all your beads, it should work.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com

  • Is it possible in firefox to close a browser window/tab using java script without modifying the configuration settings? If YES, please let me know.

    Requirement: On click of button, I want the browser window to be closed.
    Solution: I am calling below java script on "onClick()" event of button.
    function close_window()
    window.close()
    This works in internet explorer but not in Mozilla Firefox. What is the reason behind it. Is there any way out to close the browser window in Mozilla Firefox?

    Can you post a link to a page that opens a pop-up window where a close button doesn't work?
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do not click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Disallow browser window close x button when using separateFrame=false

    Hi!
    For problems with mutlicore processors and seperateFrame=true we have to workaround this with change to seperateFrame=false.
    The biggest problem is actual the behaviour when using the close button (x).
    With seperateFrame=true this closed every single form of the call stack, asks you to commit or discard your changes for every single form.
    With seperateFrame=false this closed the whole application without asking, changes are rolled back.
    Are there any possibility to disable the x button or catch the close command from browser to the forms session?
    kind regards
    Torsten

    Hello,
    one more question.
    Is it possible to change the method. so that the fpm opens within the same browser window instead of a new one?
    Maybe is there a solution with the portal?
    This is the Method to create a new Shopping cart. This opens a new browser window.
    method /SAPSRM/IF_CLL_DOM_SCW_FIN~CREATE_NEW_SHOPPING_CART.
    data:
           LV_TASKCONTAINER      TYPE REF TO /sapsrm/if_cll_task_container,
           ls_obn_components     type /sapsrm/s_wd_ui_obn,
           lo_navigation_service TYPE REF TO /SAPSRM/IF_CH_WD_NAVI_SERV.
    try.
      LV_TASKCONTAINER = mo_parent_bo_mapper->get_task_container( ).
      CALL METHOD lv_taskcontainer->GET_NAVIGATION_SERVICE
        RECEIVING
          RO_NAVIGATION_SERVICE = lo_navigation_service.
      ls_obn_components-obn_system = 'SAP_SRM'.
      ls_obn_components-object_type = 'sc'.
      ls_obn_components-operation = 'shop'.
      CALL METHOD LO_NAVIGATION_SERVICE->LAUNCH_TARGET
        EXPORTING
          IV_TARGET_TYPE          = /sapsrm/if_ch_wd_navi_serv_c=>gc_target_type-obn
          IS_OBN_COMPONENTS       = ls_obn_components
          IV_OBN_PARAM_CLASS      = /sapsrm/if_ch_wd_navi_serv_c=>gc_param_class-taskcontainer
          IV_OBN_PARAM_METHOD     = 'GET_OBN_PARAMETERS_RM'
      catch /SAPSRM/CX_PDO_ERROR_GEN.
    endtry.
    endmethod.

  • Open Browser Window Close Previous Window

    Thanks for taking a look at my problem.
    I am using Dreamweaver MX, and I have a web page where there
    are several small thumbnails. When you click on a thumbnail a
    larger picture opens in a seperate browser window. What I would
    like to do is to have this new window display some arrows that when
    clicked, cycle the to the next picture, without having to go back
    to the original window to click the next picture. This I can do,
    the trouble I am having is that when I click an arrow to bring up
    the next picture, is there a way to make the previous browser
    close. Otherwise I will have my main index page with a ton of
    residual small windows all over the place.
    Long story short: Is there a way to close a previous browser
    window, when a new browser window is called to open?
    I have some basic knowledge of web design and making a
    javascript scares the life out of me. Is there a simple add on to
    the "Open Browser Window" code.
    Problematic
    Page

    Or, open the new browser window with the same name as the old
    one.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "nickname777" <[email protected]> wrote in
    message
    news:e6mr52$pgc$[email protected]..
    > Thanks for taking a look at my problem.
    >
    > I am using Dreamweaver MX, and I have a web page where
    there are several
    > small
    > thumbnails. When you click on a thumbnail a larger
    picture opens in a
    > seperate
    > browser window. What I would like to do is to have this
    new window display
    > some
    > arrows that when clicked, cycle the to the next picture,
    without having to
    > go
    > back to the original window to click the next picture.
    This I can do, the
    > trouble I am having is that when I click an arrow to
    bring up the next
    > picture,
    > is there a way to make the previous browser close.
    Otherwise I will have
    > my
    > main index page with a ton of residual small windows all
    over the place.
    >
    > Long story short: Is there a way to close a previous
    browser window, when
    > a
    > new browser window is called to open?
    >
    > I have some basic knowledge of web design and making a
    javascript scares
    > the
    > life out of me. Is there a simple add on to the "Open
    Browser Window"
    > code.
    >
    >
    http://www.superiorcabinets.ca/Showroom_Calgary.htm
    src="/webforums/forum/images/i/expressions/face-icon-small-sad.gif"
    border="0">
    >

  • Call form in new browser window

    Hello all,
    I am trying to call a form that will appear in a new browser window, but be part of the same forms application. I am able to call the applet by using web.show_document, however you must log on to the forms services before you can access the form. I would simply like to click a button and have it call a form that opens in a new window. I am doing this for our data entry techs that need to utilize dual monitors looking at 2 separate tables.
    Thanks in advance,
    -Jordan

    Be aware that there are limitations with Forms if you are trying to run the application on the secondary monitor. Known issues related to dual monitors have been corrected in the upcoming patch set for 10.1.2. This patch is due for release soon (exact date unknown). A one-off patch is also available for 9.0.4.3.
    Take a look at this thread for more details:
    Users with two monitors

  • Open calling form in new browser window

    HI,
    I am using forms 9i. From menu item, i am calling a form using call_form, the called form is opening in same window, my requirement is the called forms want to open in new browser window. I am using mdi window.
    Any idea ?
    Regards
    Ramesh babu

    If you look in your browser address field, you will see your current forms has a (probably very) long url, one section of which is the form name. Now, you can use this as the URL argument in a WEB.SHOW_DOCUMENT() call. However:
    (1) if your URL doesn't include the userid, etc. (very likely in a production situation) you will have to log in again.
    (2) as (1) might lead to suspect, you are in a new database session.
    Why do you want to do this?
    Cheers, APC

  • BSP session not dying when browser window closes

    Hi,
    I am having a small problem with the bsp session. I shall explain the prb with an example.
    Lets say i have a bsp application BSP1. I open the application from the Favorites tab in the SAPGUi.
    Initially, i have another browser window open containing google.com(this is imp that i have another browser open all the time containing anything). I now start BSP1, then i close the window by hitting the close button of the browser, as a result the controller sends a exit view back to the frontend which never gets displayed. now i start BSP1 again from SAPGUi, and the browser instead of showing me the logon screen and the start page goes to the exit page of the application. In other words to the last URL that i visited last time in the application. Somehow when the window is closed, the session on the applicaiton server is not dying. This only happens if i have any other browser open all the time containing any thing.
    If i do not have any other browser open, and then i follow the above sequence of events,everything runs smoothly. Also, in the previous case, if i close the google window also and start the application again, everything runs smoothly. In IE settings , in Advanced tab there is a setting for REUSE EXISTING WINDOWS FOR LAUNCHING SHORTCUTS. If i set this option, everything runs smoothly, even if i have a Google(whatever) window open all the time. If i do not set this option, i run into the problem as in the first case. Also, if instead of opening the application through the SAPGui i open another browser from the taskbar and type in the URL , everything runs smoothly inspite of another google window being opened all the time.
    Also this problem is evident in systems with BASIS 640/level 10 and BASIS 620/level 19. It might be present in other versions also but i am working on these two systems with these versions. This problem does not pop up on BASIS 700.
    If on exit, within the controller, i reset the keep_context attribute of RUNTIME  object, everything runs smoothly.
    could you please guide me as to what can be the problem here and how it can be solved. It is important. Any kind of help and guidance would be highly appreciated.
    Looking forward to your response,
    Thanks and best regards,
    Ghufran

    The very first important aspect to understand is that CANCEL kills the session long before the request reaches the ABAP stack. So what ever you want to do, this is not the way to go.
    From reading your first post in this thread through, I have the impression that you might have some confusion between stateful versus authentication. No, I it is not the problem/solution, but just that your very long descriptions without using consistant terminology makes it difficult to understand where we are going.
    Thus, I would recommending read this article for background information:<a href="/people/mark.finnern/blog/2003/09/24/bsp-in-depth-confusion-between-stateless-stateful-and-authentication">BSP In-Depth: Confusion between Stateless, Stateful and Authentication</a>.
    Next, you CAN NOT "redirect it to the browser on the onbeforeunload() event". Well, at least I never have never succeeded.
    Once the closed button is hit, you have not many options. One idea is a window.open, see system application for examples. The other is the image loading trick that Thomas describes in his weblog. Both ideas will actually solve your problems (once you really understand what is happening). This is unfortunately not always perfectly easy.
    brian

  • Force a window browser window close when open docs FROM THE KD

    We have an issue when opening documents from the kd a browser window opens, then the office doc opens. But it leaves the blank browser window there open. I have looked into it, and it appears the ptcommonOpener may be able to be modified with a piece of javascript "currentWin.close" in the href that gets built with the link.
    Does anyone have any experience with this or another way to do it.
    Thanks

    the problem has been solved for me following the process :
    1 -close entourage
    2 - start and follow the complete reconstruction of the entourage database ;
    3 - in the "entourage" menu, disable "office reminds" or "office recall" (i don't know the exact name because my entourage is in french)
    For me it has worked. when i click on the dock entourage shortcut it opens without showing the new message windows at start.

  • Generate new browser window on using include directive/action tag in curren

    Hi Life line
    if i used jsp include directive/action taag inside my current jsp code it open new browser window but if i
    not use that include directive or action tag in my jsp source it properly display next jsp in
    same browser window
    how i can rid of this .i am confuse why it happens
    thanks
    Vivek Harnal

    1) on clicking view button it submit other page by
    script function()
    2) it work fine & display in same browser window if i
    am not incliudes jsp page after body tag .Your included JSP has a head and body of its own. If the including page has a head and body of its own, then the two will clash. Generally, it is best to make includes be fragments, ie, have no
    <html> <head> </head> <body> </body> </html> tags.
    3) included jsp use for standard menu based Header
    source of included page is
    <script type="text/javascript"
    src="menu_array.js"></script>
    <script type="text/javascript"
    src="mmenu.js"></script>
    <html>
    <script language=javascript>
    function show()
    // Master array in Menu_Array.js contains sub menu
    options available to super administrator
    // show the menu
    {     popup("master")
    function show1(){
    popup("requisition")
    function show2(){
    popup("purchase")
    function show3(){
    popup("receipt");
    function show4(){
    popup("reports");
    </script>
    <head>
    <link rel="stylesheet" type="text/css" href="css.css">
    <title>Procurement Automation System</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <base target="main">This means every link you click on will be sent to a new window or frame whose name is main. If no such window or frame exists, make one. If you do not want your links to bring you to a new window, you need to remove this <base target="main"> line.
    >
    >
    </head>
    <body bgcolor="#FFFFFF" text="#000000" leftmargin="0"
    topmargin="0" marginwidth="0" marginheight="0">
    <table width="982" border="0" cellspacing="0"
    cellpadding="0">
    <tr>
    <td><img src="images/header_inside.jpg" width="1004"
    height="106"></td>
    </tr>
    <tr>
    <td>
    <table width="1012" border="0" cellspacing="0"
    cellpadding="0" bgcolor="#a4c3cd">
    <tr>
    <td width="860" bgcolor="#a4c3cd">
    <table width="819" border="0" cellspacing="0"
    cellpadding="0">
    <tr>
    <td width="5"> </td>
    <td style='cursor: hand' width="113" ><b> </b><A
    onmouseover="javascript:show()"><b>Master
    Module</b></a>
    <td style='cursor: hand' width="142"><b> </b><A
    onmouseover="javascript:show1()"><b>Requisition
    Module</b></a></td>
    <td style='cursor: hand'
    width="149"><b> </b><A
    onmouseover="javascript:show2()"><b>Purchasing
    Module</b></a></td>
    <td style='cursor: hand'
    width="140"><b> </b><A
    onmouseover="javascript:show3()"><b>Receiving
    Module</b></a></td>
    <td style='cursor: hand' width="100"><b>
    </b><A
    onmouseover="javascript:show4()"><b>Reports</b></a></td></tr>
    </table>
    </td>
    <td align="left" width="148">
    <table border=0 cellspacing=0 bgcolor="#a4c3cd">
    <td width="24%" align="center" valign="middle"><a
    href="help.htm" ><img src="images/bt_help.gif"
    width="52" height="20" border="0"></a></td>
    <td width="4%" align="center" valign="middle"><img
    src="images/white_bar.gif" width="2" height="17"></td>
    <td width="32%" align="center" valign="middle"><a
    href="logoff.jsp" target="_self"><img
    src="images/bt_logout.gif" width="70" height="20"
    border="0"></a></td>
    <td width="8%"> </td>
    </table>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>

  • File.browse() window close

    Hi,
        When we use the browse() functionin File  the file selection window appears. Is there any way to close that window using code. What I need to accomplish is I want to close the file selection dialog box automatically  after waiting a few seconds. How we accomplish this?
    I tried to dispatch the CANCEL event but no sucess
    I want to close this window
    Thanks in advance

    Upgrade to forms 6i and you'll have a built in for that
    (get_file_name). for 4.5 try looking for the d2kwutil.pll I
    think there is a method there that will do this.

Maybe you are looking for

  • How to create the select option for the Plant in screen (Module pool)

    HI, I am developing one module pool program and I have below requirement, currently plant is acting like PARAMETER and the now it should be changed to select option. how to create the select option in the screen Thanks and regarding, Malla Moderator

  • Error installing j2SDK 1.3.1_02 on Windos XP

    When I try installing J2 SDK 1.3.1_02 on XP, it returns an error when it starts "Setting up JAVA 2 Runtime Environment. This is the erro: "JAVA 2 Runtime Environment Setup failed with a return code -1" Any ideas what this is and how to fix it. Thanks

  • Does Faces work with Tags?

    Hi, I have iPhoto 08, about 30,000 photos, and I've already tagged maybe 3000-5000 photos with names (I have probably 50 different tags for people, each tag being the person's name). I'm planning to buy 09 and install soon. Two questions: Does the "F

  • MBP Late 2011 - sata 6 ssd in optibay?

    Has anyone gotten a SATA 6 SSD to work reliably in the optibay of a late 2011 MBP? I know there were issues in the past - adn I failed to get a Seagate hybird to work in early 2012. But there have been firware updates, and I've recently had my logic

  • DI API Deadlocks in SQL 2005 database server

    Hello All, I have an Issue, which is coming on large databases ( > 50GB) and number of users >  20. I have read the following notes 1269591, 1489753, 1318311, 1231444 , 1344641 , 1316554 also contributed in the following thread: Workaround: Each SAP