Handling browser close

Hi
I have a requirement to handle browser close so that i can go ahead and release some specific locks on the server. So using javascript's functions like onclose(), onunload() and even onbeforeunload() event .. i went to do a window.open which has the logic for executing some server side code .. this works perfectly .. however due to pop-up blockers the window.open() functionality doesnt get executed ... so whats the way to resolve this.

Or use an IFrame to make a request to the page you would use to do the work:
<html>
  <head>
    <title>Hidden Frame</title>
    <script type="text/javascript">
      function closeStuff() {
        document.getElementById("hiddenFrame").src="doCloseStuff.html";
    </script>
  </head>
  <body onUnload="closeStuff();">
    <h1>Blah Blah Blah</h1>
    <iframe src="" id="hiddenFrame" name="hiddenFrame"
         width="1" height="1" frameborder="0">
    </iframe>
  </body>
</html>Or you could run an XMLHTTPRequest to the server side page that cleans up for you. See: http://www.jibbering.com/2002/4/httprequest.html

Similar Messages

  • Trouble detecting browser close in Internet Explorer

    Please help!
    I'm trying to detect when the browser closes (or tab closes, or page reloads, etc.) so that I can save user information. I've followed the advice of others on the web, and have it working with Firefox, but not IE. The code in my wrapper is below, which attempts to get access to the embedded swf object a variety of ways to presumably handle multiple browsers. PLEASE HELP!
    //  Function to get a reference to the embedded swf file
                        function getFlashMovieObject(movieName)
                          if (window.document[movieName])
                              return window.document[movieName];
                          if (navigator.appName.indexOf("Microsoft Internet") == -1)
                            if (document.embeds && document.embeds[movieName])
                              return document.embeds[movieName];
                          else // if (navigator.appName.indexOf("Microsoft Internet") != -1)
                            return document.getElementById(movieName);
    Here's the code that calls this function:
                        window.onbeforeunload = function() 
                            var myApp = getFlashMovieObject("MySwf");
                            return myApp.onCloseApplication();
    Here's the code that embeds the swf:
                      var flashVars = {};
                      var strHref = window.location.href;
                      if ( strHref.indexOf("?") > -1 )
                            var strQueryString = strHref.substr(strHref.indexOf("?")+1);
                            var aQueryString = strQueryString.split("&");
                            for ( var iParam = 0; iParam < aQueryString.length; iParam++ )
                                var aParam = aQueryString[iParam].split("=");
                                flashVars[aParam[0]] = aParam[1];
                    var params = {};
                    params.quality = "high";
                    params.bgcolor = "#ffffff";
                    params.allowscriptaccess = "sameDomain";
                    var attributes = {};
                    attributes.id = "MySwf";
                    attributes.name = "MySwf";
                    attributes.align = "middle";
                      //create your instance of your SWF
                      swfobject.embedSWF("MySwf.swf", "flashContent", "100%", "100%", "10.0.0", "expressInstall.swf",
                        flashVars, params,attributes);

    To make the hyperlinks in PDF file work, do the following:
    Open your Adobe Reader
    Then select Edit à Preferences… from the Action Bar.
    To make the links active, select Documents (under Categories).  On the right side, now under PDF/A View Mode, using the drop-down change  “Only for PDF/A documents”  to  “Never”.   Now click the OK button.

  • Handle browser keyboard shortcuts (like F5)

    Hi,
    I was wondering if it's possible to handle browser keyboard shortcuts (like the F5, F6, etc) and disable it.
    I can do this by Javascript and an Applet but not in a Flex application.
    EDIT: forgot to say that when the Flex application has focus I cant handle the shortcuts in Javascript, so it's impossible to trap the keys in Javascript and sent them to the Flash movie.
    There's some issue reported in http://bugs.adobe.com/jira/browse/FP-96
    Thank You

    Have you? And did you look at the issue link I sent?
    I know how to do a EventListener! the problem is that the Flash Player does not 'trap' the browser shortcuts !!!
    The manual says:
    "When handling a key or key combination that the underlying operating system or browser recognizes, the operating system or browser generally processes the event first. For example, in Microsoft Internet Explorer, pressing Control+w closes the browser window. If you trap that combination in your Flex application, Internet Explorer users never know it, because the browser closes before the ActiveX Flash Player has a chance to react to the event."
    So I'm guessing that, for some kind of reason, Flash Player is the only ActiveX that does not handle this.

  • Detect Safari browser close with the iPad 3

    Detect browser close with the iPad 3
    We have a web site being used on the iPad 3 through Safari.
    Our web site is used in a public setting and multiple users login to use it at different times. We have a questions about user account security.
    When a signed in user clicks the home button on the iPad , which minimize Safari and returns them to the home screen, can the user be signed out of our web site? We don’t want someone else to come and open the Safari browser and have access to the previous user's account information. Is there a client-side event that is triggered that we can handle so we can log the user out of the site?

    Is the iPad shared by everyone at this public setting?
    There is currently no way to handle different users on the iPad (or any iOS device).
    They are designed as single user devices.
    If your company is eligible for an Enterprise account, then you could write an app that could handle clearing user credentials but not in the current "normal" environment.

  • Record "logout" on Browser close

    Is there a way to record a browser close? We're trying to track user's time inside the application. I've already instituted a trigger to catch the login and record, but unless the user actually uses the logout link in the application, I am stuck. Is there a way to activate a PL/SQL code snippet when the browser is closed? Can I institute this on Page 0?

    You could use some javascript to catch the window.onbeforeunload event, but that is kludge to say the least... I believe there is a plugin for APEX 4.0 that might help here...: http://www.apex-plugin.com/oracle-apex-plugins/dynamic-action-plugin/skillbuilders-save-before-exit_43.html
    They claim it will handle the browser closing as an event.. So you could use this to catch them closing the browser..
    Thank you,
    Tony Miller
    Webster, TX
    I don't know what your problem is, but I bet it's hard to pronounce.
    If this question is answered, please mark the thread as closed and assign points where earned..

  • [svn:fx-trunk] 11595: Checking in Sujata' s fix to FXGUtils for SDK which handles implicit close paths correctly.

    Revision: 11595
    Author:   [email protected]
    Date:     2009-11-09 16:34:49 -0800 (Mon, 09 Nov 2009)
    Log Message:
    Checking in Sujata's fix to FXGUtils for SDK which handles implicit close paths correctly.
    QE notes: Please retest bug test case.
    Doc notes: N/A
    Bugs:
    SDK-23093 - Unclosed path in static FXG displays with horizontal glitch
    Reviewer: Sujata
    Tests run: Checkintests, Bug test case
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23093
    Modified Paths:
        flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/fxg/swf/FXG2SWFTranscoder.java
        flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/dom/GraphicContentNode.ja va
        flex/sdk/trunk/modules/fxgutils/src/java/com/adobe/internal/fxg/swf/ShapeHelper.java

  • How can we handle browser settings while dealing with the security ?

    Hi ,
    how can we handle browser settings while dealing with the security ?When we configured security in web.xml , during the first request the container is asking for the authentication credentials once they are provided it go's on. but when the user gives a fresh request from the second window within the same browser that time it is not asking for authentication. How can we overcome this.Is there anything to do with server configurations?
    How can we make the container no to keep the things or act like session?

    Ya... I am taking a small example need not happen always but a kind of possibility i am thinking off.
    once the user sign out and just left without closing the browser and a friend (suppose not a good friend ... just kidding...) of that user may open the same jsp or file .This time the security is breached. If that feature or property exists....
    I know what you might say ... the user will log-out before leaving where a programer might invalidate the session at the time of log out.
    Consider the case of a bad Programing or just a programer might forget to invalidate,At that time as a application administrator how can he solve that issue.
    Thanks.......
    Edited by: user8483670 on Jun 6, 2011 1:08 AM
    Edited by: user8483670 on Jun 6, 2011 1:09 AM

  • How to handle browser or application crash out of our application in java.

    I am running my application(testing automation tool) through ANT . when i run the same over the remote the browser is getting crashed. so if i need to handle it , i should handle outside my application. my application is written only in pure core java. Plz provide me the solution for handling browser crashes outside our application. so that when i run my application over the remote the browser should not crash.... if i use javascript to handle , how do i communicate java script code with pure core java code......

    this is not directly a security related question, but jars within jars won't be found by the JRE; they won't appear in the classpath.
    Some googling:
    http://forum.java.sun.com/thread.jspa?threadID=740123&messageID=4245964

  • Lumia 520-Internet Explorer & UC browser close aft...

    Hi,
    I am using nokia Lumia 520 since 15 days, I am facing problem with browsing. Both internet explorer & uc browser close abruptly in the middle of browsing after browsing for sometime. If anybody knows the solution for this problem plz let me know

    have you checked you are up to date with the latest firmware for your device and that you are up to date with Nokia apps from the Store? also try performing a soft reset.

  • Capturing browser close event

    Hello everyone,
    Even though this question has been answered before, I find that none of the answers seem to work for me.
    My problem is the following: Locks are placed on records and tables at certain points in my application. But if the user simply closes the browser without closing the application properly, all the locks are still in place. So I need to catch an event that allows me to ABAP my way out of this.
    I have the following BSP page which loads my application:
    function startBSPApplication()
    function endBSPApplication()
      <frameset id="<%=guid %>_FRAMESET" rows="*,0" onload="startBSPApplication('<%=guid %>_A');" onunload="exitBSPApplication();" noresize framespacing="0" frameborder="0" border="0">
        <frame name="<%=guid %>_A" src="session_default_frame.htm">
        <noframes>This browser does not support frames.</noframes>
      </frameset>
    The start and end functions simply start and end a session, and I find myself unable to actually call an ABAP function in there. All ABAP code placed inside the javascript functions is called everytime the page is loaded, not everytime the function is called and that's not what I want.
    I also already tried the <bsp:htmlbEvent> tag, but I couldn't get that to work either. I tried it like this:
    Notice however that I wrote this on top of the frameset. Does this mean that the onunload event will be called twice and does this cause a problem?
    I tried to call the onDestroy event from within my endBSP function, but nothing happened either.
    <htmlb:content design="design2003" >
      <htmlb:page title="Capture browser close " >
        <htmlb:form>
          <bsp:htmlbEvent id      = "myid"
                          onClick = "onDestroy"
                          name    = "onDestroy"/>
          <script for="window" event="onunload"  type="text/javascript">
               alert('Starting the Server Event');
               onDestroy();
           </script>
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    Does anybody have another suggestion, or notice me overlooking something?
    Thank you in advance,
    Niels.

    Hi Eddy,
    I can't find anything really helpful in that blog. Except maybe adding the onbeforeunload attribute to my frameset and calling a JS function to back it up.
    The problem still persists that any ABAP you put in a JS function is executed regardless of wether or not the function is actually called.
    I need to get to my DO_HANDLE_EVENT somehow when the user closes the window.

  • Call Webservice/API during browser close event

    Hello,
    I am using JDEV 11g. My application catches the browser close event to call a return Task Flow.
    I am wondering if its possible to call a webservice/API during the same event.
    Thanks
    Padmapriya

    Probababy too late to ask .. did u manage to get this resolved.
    I am not able to call any server Listeners during browser close event ...
    Details here -Re: Calling an ActionListener on browser window close using JS event queuing

  • Browser close button / unload event

    Hi,
    In Ie8 session is carrying when i close the browser using X button. Is there any way to capture this browser close button or any portal unload event.
    Thanks
    Manu

    There is no clean way to do this. The only way i know of is to have a private global javascript variable true/false (true = show the popup, false = show popup) where the default value is true. On every click of link / form submit where you need the popup to be suppressed , set the value as false. (you can do this using a js library which can attach events to onsubmit, onclick of all links)
    However the behavior you are proposing is really , really annoying (as a user), consider your interface before implementing something like this. Valid usecases are prompting the user to save changes before leaving the page, not you are leaving the website (Thats why i typed something or closed the browser)

  • Can Flex detect browser close event?

    Is Flex notified by the browser when the browser is closed
    (or browser tab)? I need to be able to save any unsaved data in the
    application before the browser closes.
    Thanks in advance

    Thanks for your reply.
    I found a good example that I followed and got it working:
    http://flexblog.faratasystems.com/?p=134

  • Catching browser close event and showing my own popup

    Hi,
    I want to show my own warning popup on browser close event. Kindly help me with the solution.
    Thanks a lot in advance.
    Lavanya.

    Lavanya,
    I don't think you could show a ADF Popup during the onload event. Instead, you could use javascript's confirm method to prompt the user to choose what they want to do and perform that operation accordingly.
    Ex :
    jspx code
       <af:document id="d1" onunload="performUnloadEvent" clientComponent="true">
                <af:resource type="javascript">
                  // For Mozilla and Firefox
                  if(window.addEventListener){
                  window.addEventListener('beforeunload', function (event) {
                    showConfirm();
                  // For IE
                  else if(window.attachEvent){
                       window.attachEvent('onbeforeunload', function (event) {
                    showConfirm();
                  function showConfirm(){
                          var eventSource = AdfPage.PAGE.findComponentByAbsoluteId('d1');
                          var sel = confirm("Are you sure you want to exit?");
                        if(sel==true){
                            alert('Perform OK Operation');
                            var x = AdfCustomEvent.queue(eventSource, "handleOnUnload", {result : 'ok'},false);
                            var y = 0;
                        else {
                        alert('Perform Cancel Operation');
                         var x = AdfCustomEvent.queue(eventSource, "handleOnUnload", {result : 'cancel'},false);
                         var y = 0;
                </af:resource>
                <af:serverListener type="handleOnUnload" method="#{UnloadHandler.onUnloadHandler}"/>
                <af:form id="f1" clientComponent="true">
                </af:form>
            </af:document>onUnloadHandler method in bean
        public void onUnloadHandler(ClientEvent clientEvent) {
            System.out.println("Unload Event fired..");
            String outcome = clientEvent.getParameters().get("result").toString();
            if(outcome.equalsIgnoreCase("ok")){
                System.out.println("Outcome is OK ");
                // Perform some operation like Commit;
            else if(outcome.equalsIgnoreCase("cancel")){
                System.out.println("Outcome is Cancel ");
                // Perform some cleanup operation like Rollback;
        }-Arun

  • Browser Close Event

    Hi,
    I want to track Browser close event in EP to close all the sessions of the user.
    Plz guide me with detailed steps.
    Thanks in advance.
    Regards,
    Priya

    Hi search for "Browser close event" in google.
    Result: there is no such thing. You can do something with onbeforeunload but that might not work for all browser.
    Kai

Maybe you are looking for

  • Office 2013 can't open word, excel files from the network after upgrade to 8.1

    Hello, Recently, I upgraded all PCs from WIN 8 to Win 8.1. After the upgrade I noticed that I can't open any word documents and excel files. Before the upgraded I have no problem opened any files. All PCs have over 500GB free space on hard drive. Oth

  • Java application not working

    Running Win98. I somehow removed the Java application from my computer, and am unable to open any java appelets or javascript. Where can I download the JVM for Win98. Currently all I have is JVM 1.5.0_05 (which is for Win98SE), and doesn't work. I we

  • Removing photos in iphoto

    Hello, I have been reading some threads on how to delete photos from iphoto and to be honest it is making my head spin.  I need an answer in simple terms.  I have a ton of pics in iphoto and I need to remove them from my computer as they are taking u

  • Can't set an alert on Calender entries on my Mac

    I'm running OS X 10.8.3. I use two Google Apps domains for my calendars. I have no problem adding Calendar alerts to events on my iPhone, but if I try to set them on my MBP, they disappear almost immediately. Has anybody else seen this problem, and k

  • New laptop - cs6 too small to use!

    I have just bought a new laptop with screen resolution of 2560x1440. When I installed my cs6 software I found that it was too small to use! Any help on what to do would be gratefully received - I don't mind if I have to purchase an upgrade if it enab