Execute code when IE Browser closes

Help!  I'm trying to find a way to run a SQL statement when a user closes a IE window (X's out).  I've found information on the onBeforeUnload event but I've been unsucessful at getting it to run.
Does anyone have another suggestion?  Is it even possible to execute code upon closing a window?
Thanks!!!

Thanks ilssac.  I figured this was the case based on my research but I thought I'd present it to the Forum just to be sure.
Basically, I've been asked to limit the number of logins to a small Coldfusion application.  I've coded it so that I increment a counter in the DB and I decrement it when the user logs out properly (by clicking a logout link).  But if the user just closes the window then the decrement doesn't happen and this created problems.
If you have any suggestions I would really appreciate it.
Thanks for your time!!!!

Similar Messages

  • I Want to Execute Code When a session Expires

    hi friends,
    I want to execute some code when ever a user ends his session. I came to know this can be accomplished by using HttpListener. But if any body give a example it will be lot more clear.
    Thank Q
    Srinivas

    Or SessionListener. - MOD

  • Don't want to re-execute applet code, when refresh browser

    Hi,
    I am developing online exam project, here my issue is in timer, I am creating timer in thread.sleep(1000); (ie) 1000 mili sec = 1 sec. once exam started, i am started reducing timer value. While moving to next question, I want previous Applet timer value in next page. Here i am getting initial value of each time refreshing,
    example:
    suppose timer running in browser like this : 00:00:46 ----> when refresh same page i need value reduce from 00:00:46, But its reload from initial value (ie): 00:00:59 in below example code.
    Here is my Applet code :
    import java.awt.*;
    import java.util.*;
    import java.applet.*;
    import java.net.*;
    public class myclock1 extends Applet implements Runnable
    Thread t,t1;
    int hour=0,minute=0,second=0;
    URL targetURL;
    String URLString = "http://localhost:8080/testing/examresult.jsp";
    AppletContext context;
    public void start()
    minute = Integer.parseInt(getParameter("min"));
    second = Integer.parseInt(getParameter("sec"));
    context = getAppletContext();
    t = new Thread(this);
    t.start();
    public void run()
    t1 = Thread.currentThread();
    repaint();
    public void paint(Graphics g)
    if(hour==0 && minute==0 && second==0)
    try
    targetURL = new URL(URLString);
    catch (MalformedURLException e)
    // Code for recover from the exception
    context.showDocument(targetURL);
    t.destroy();
    t1.destroy();
    this.destroy();
    second--;
    if(second==-1)
    second = 59;
    minute = minute-1;
    if(minute==0)
    if(hour>=1)
    hour = hour - 1;
    minute = 59;
    g.drawString(hour + ":" + minute + ":" + second, 20, 30);
    repaint();
    try{
    t1.sleep(1000); /// 1000 mili sec = 1 sec
    catch(InterruptedException e)
    In JSP Page Code:
    <jsp:plugin type="applet" code="myclock1.class" height="150" width="300">
    <jsp:params>
    <jsp:param name="min" value="0" />
    <jsp:param name="sec" value="60" />
    </jsp:params>
    </jsp:plugin>
    How to do that, Urgent Plz help me.
    Thanks in Advance,
    S.Shyam.

    Is it SAX, Dom, JAXB or something else you are talking about?

  • How to execute code when press the ENTER key

    Hello,
    I've write the code in Key-ENTER trigger, but it doesn't work when I press ENTER key.
    Best Regards
    Joe

    Matth M
    Thank you.
    The following msg. from help system shows that key-enter trigger will execute when the ENTER pressing event occurs. Need your more help.
    Regards
    Joe
    >
    (index: "DO_KEY" )
    Executes the key trigger that corresponds to the specified built-in subprogram. If no such key trigger exists, then the specified subprogram executes. This behavior is analogous to pressing the corresponding function key.
    Built-in............Key Trigger............Associated Function Key
    ENTER............Key-ENTER............[Enter]

  • Execute code when task flow is finished

    I have two task flows: TFBrowseRecs and TFUploadFile.
    I initiate calling of TFUploadFile from view (by af:button) inside TFBrowseRecs.
    TFUploadFile has return-value-definition which is is used to return value which is created in TFUploadFile.
    TFUploadFile is opened as new transaction as Dialog and has two task-flow-return activites, one as <commit/> and other for <rollback/>.
    When <commit/> activity occurs I can pass return value back to TFBrowseRecs successfully.
    I want also to execute some code/action in TFBrowseRecs immediately when TFUploadFile is finished (insert new record into VO).
    I think, I can define EL for method call inside <after-listener> which is defined inside TFBrowseRecs, but I can't find any useful example for this approach.
    Btw, I could execute this code/action inside TFUploadFile but I want that TFUploadFile is black box for TFBrowseRecs and other TFs.
    1. Is this approach OK?
    2. Can you show some example how such a method should look like
    Regards,
    Sašo
    Edited by: Sašo C. on 29.9.2011 0:36

    I doubt finalizer is right place regarding my requirements:
    I want called TF (TFUploadFile) to be black box for calling TF (TFBrowseRecs). In TFUploadFile I just insert row in one VO and return ID of inserted row to TFBrowseRecs.
    What do you think?
    Regards,
    Sašo

  • Executing code when a listener is added

    Is there a way for an event generater to execute certain code whenever an event listener registers with it? If so, where would you have to put this code?

    You write the appropiate support class for listeners to this event, that is, the class which handlers add<Something>Listener, and register only an instance of this class as a listener of the original event. In the add<Something>Listener, before adding the object in the listeners list, you execute the code you wish.
    If this doesn't seem as an appropiate solution, will you please provide some more details? The topic is interesting, thanks.

  • Running abap code when Browser is closed,

    Hi,
    In my application,  need to delete couple of rows in a table when the user closes the browser. In order to do this i have written a JavaScript when executes itself when the browser closes. When i code a alert message it executes fine when the browser closes but, when i write an abap code it gets executed when the page loads itself. I have tried to methods. Both aren't working.
    Method1 :
    <%@page language="abap" %>
    <html>
        <head>
        </head>
      <script language="JavaScript">
        window.onunload = unloadHandler;
        function unloadHandler() {
                    <%
                      delete from ZDATALOCK
                      where auid = sy-uname.
                    %>
      </script>
        <body>
            <tr>
            <td>
               <table  border="0" width="100%" height="100%" align="center">
               <tr>
                   <td>
                   <iframe src          = "mas.do"
                           style        = " overflow:visible; height:100%; width:100%; "
                           name         = "Form"
                           marginheight = "0"
                           marginwidth  = "0"
                           frameborder  = "0">
                   </iframe>
                   </td>
               </tr>
               </table>
            </td>
            </tr>
        </body>
    </html>
    Method2 :
    <%@page language="abap" %>
    <html>
        <head>
        </head>
      <script language="JavaScript">
        function dellock() {
                    <%
                      delete from ZDATALOCK
                      where auid = sy-uname.
                    %>
      </script>
        <body onunload=dellock()>
            <tr>
            <td>
               <table  border="0" width="100%" height="100%" align="center">
               <tr>
                   <td>
                   <iframe src          = "mas.do"
                           style        = " overflow:visible; height:100%; width:100%; "
                           name         = "Form"
                           marginheight = "0"
                           marginwidth  = "0"
                           frameborder  = "0">
                   </iframe>
                   </td>
               </tr>
               </table>
            </td>
            </tr>
        </body>
    </html>
    Kindly help.

    Hi,
    ABAP code is server side and JS is client sides. You can't execute ABAP on the front end. What I suggest is that you submit a form before you actually close a window.
    document.someform.submit();
    window.setTimeout('window.close()',5000);
    The close will only happen after 5000ms.
    Check http://www.devguru.com/Technologies/ecmascript/quickref/win_settimeout.html for details.
    in the oninputprocessing you can do your
    delete from ZDATALOCK
    where auid = sy-uname.
    Also check /people/eddy.declercq/blog/2006/03/20/wake-me-up-before-you-go-go
    Eddy

  • Executing code on EXIT_ON_CLOSE

    I was wondering how you execute code when a JFrame closes using the X button (ie, without using a menu). Because you don't attach an ActionListener to it, I am unsure as to where I would place code that I would like to execute before the program exits.
    Thanks

    add a WindowListener to the JFrame; windowClosing() will be called when the X is clicked (setDefaultAction is more or less just a convenience method for this)

  • 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.

  • IPlanet Messaging Server -- kill session at browser close

    iPlanet Messaging Server 5.2 HotFix 2.09
    We found a potential security risk.
    When a person loads Messenger Express through the web and closes their browser, another person can come in behind them and resume the previous persons session. This is accomplished by going through the browser history and accessing any of the links that point inside the mail client.
    When the browser closes, the session isnt killed. Its only killed/inaccessible if the user times out or clicks log-out. We've tested this on just about any browser we can get our hands on.
    Is there a fix/patch/workaround for this? I've combed the documentation and the site and can find nothing.
    We are using the product in an University environment and this can be particularly nasty in the labs.
    Thanks!

    iPlanet Messaging Server 5.2 HotFix 2.09
    We found a potential security risk.
    When a person loads Messenger Express through the web
    and closes their browser, another person can come in
    behind them and resume the previous persons session.
    This is accomplished by going through the browser
    history and accessing any of the links that point
    inside the mail client.Yep. that's true. And, it 's not possible to "fix" that. The reason it cannot be fixed, is that http is stateless. The server can't know when you simply close a browser, instead of you still being there.
    There is an idletimeout that defaults to 10 minutes.
    >
    When the browser closes, the session isnt killed. Its
    only killed/inaccessible if the user times out or
    clicks log-out. We've tested this on just about any
    browser we can get our hands on.Right. This is a basic limitation of the http protocol. It's not something we CAN fix.
    >
    Is there a fix/patch/workaround for this? I've combed
    the documentation and the site and can find nothing.
    We are using the product in an University environment
    and this can be particularly nasty in the labs.You will have to educate your users to log out. That's all I can suggest.
    >
    Thanks!
    ashley

  • How do I execute some code when a line of a table control is selected?

    Hi,
    I would like to execute some code when a line of a table control is selected.  At the moment I have to select one or multiple rows and then press enter, this forces a screen refresh and my code is executed but I would like the code to be executed as soon as any line is selected.
    I've done something like this using ALV grids and object orientated code but is there a way of doing this in a normal non-OO table control?
    Thanks in advance.
    Gill

    Hi,
    U need to declare a char1 field for marking (mark field).  This will reflect with value 'X' in your tcontrol internal table for all the selected rows. 
    Now u need to handle the okcode for enter in your PAI.
    There u need to loop through the table for all marked fields.
    There after u can do what ever u want.
    Venkat.

  • How do I close a PDF document automatically when the browser is closed?

    I have a web app writen in HTML/ASP. In order to acccess this app, our users have to enter a password and user id. Once on the main page of the app, they can click on a link which opens the reader in another window. Quite often, when finished with the app, they close the browser, but leave the reader window open (with sensitive information). It is becoming to riskly to hope that they remember to close that window also, even with visual reminders. I would like for that window to close automatically when the browser with the app is closed.
    Can this be done?

    Let me elaborate a little more on what I am trying to do.
    (1) A website (#1) is opened after entering a UID and PWD.
    (2) Within website #1, a link is clicked which opens a second web app (#2) in a seperate window using window.open().
    (3) Within website #2, a user can click on a link which opens a PDF as _SELF.
    (4) If the user:
         (a) exits out of website #1 by closing the brower
         (b) we would like to automatically close the PDF from website #2 also, as this contains sensitive information and most of the time the users are forgetting to close it

  • In the 20.0.1 update, I noticed when you accidentally close your window your browsing it automatically closes your downloads. Can I bypass this?

    In the 20.0.1 update, I noticed when you accidentally close your window your browsing it automatically closes your downloads. Previous versions when you close your window and reopen Firefox your downloads are unaffected until your downloads are finished or you cancel it yourself. Is there a setting I can set that my downloads are unaffected when I close my window.

    You can set the browser.download.manager.quitBehavior pref to 2 on the about:config page.<br />
    That will make Firefox ask for confirmation if you want to cancel the download if you close Firefox.
    See:
    * http://kb.mozillazine.org/browser.download.manager.quitBehavior
    *http://kb.mozillazine.org/about:config

  • When the browser is open the mouse does random things in all open programs, I can close FF and it works fine is there a mouse bug?

    Since the last upgrade, when the browser is open the mouse randomly clicks on things changes windows by itself. In addition highlighting things to cut and past is almost impossible... this transfers over to all open programs word, movie maker, audacity, etc... and as soon as the browser is close the problems go away... I am having this on two computers the first is a 32 Bit Vista system with a corded mouse the second is a dual boot 64 bit Win 7 and Linux Mint laptop using a Logitech cordless mouse and built in mouse pad both mouse and pad does this... in both operating systems.
    I thought it was a problem with the mice or interference with the wireless receiver or from an Xbox in the same room interfering with the systems, however updated drivers were downloaded and installed on both computers for all three operating systems.

    '''[https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode Start Firefox in Safe Mode]''' {web link}
    While you are in safe mode;
    Type '''about:preferences#advanced'''<Enter> in the address bar.
    Under '''Advanced,''' Select '''General.'''
    Look for and turn off '''Use Hardware Acceleration'''.
    Poke around safe web sites. Are there any problems?

  • Dynpro application: how to perform some  code when user click window close

    Hello,
    I'm developing dynpro application. This application needs to perform some code when exiting.
    I can do that with MODULE xxxxx AT EXIT-COMMAND. But this code can't be performed when user of application click on button closing window (classic R/3 window, not pop-up).
    Does anybody know how to bind some code to clicking on button closing window?
    Best regards,
    Josef Motl

    As far as the prompt that you get when you close the last window is coming from the counter that SAP maintains regarding the number of open sessions(windows). When this counter reaches 1, I guess they have a check to issue a prompt. There was a discussion in this forum a long time back regarding how we can know that session id like SM04. There was no conclusion reached then. Theoritically, let us know you know this id for the session in which the user opened a particular page, then you can see if that session is deleted and then take the necessary action. There are some TH_* function modules that seem to be promising, but I was not able to conclusively achieve the control over a particular session.
    See if you can look at SM04 and get an idea. Please do let us know if you find the solution.
    Srinivas

Maybe you are looking for

  • While trying to open the mail , it shows a blank screen then went to home page.

    while trying to open the mail , it shows a blank screen then went to home page.

  • Is there a way to create something like macros in Motion?

    We have a project that requires complex animations on many different objects, which are all similar, but require variations and occur at different times, and are looking for the most efficient method to manage it all. We were wondering if we could ge

  • Basic line chart help

    I am relatively new Crystal reports 11 and am having problems creating a lsimple ine chart. I am trying to trend two types of network errors over time. The type of errors are in one field and the values are 1 or 2, I have two formulas, one converts a

  • Stop action doesn't work

    I have a simple website with five pages set up. There is no code other than the code on the first frame, plus a stop action on each section. The first thing in the code is the stop action, but it still keeps running through all the frames when I test

  • Seagate Hard Disk is not detecting

    Hi Friends, I have an AMD Athlon 64 Processor with MSI motherboard of VIA K8M800-CE + VT8237R Chipset. My Previous hard disk was a 120 GB Seagate SATA which is lost now. I purchased a new 250GB seagate SATA disk and try to install Window XP 2 in it,