How to detect browser close event in flex ?

How to detect browser close event in flex ?

This link may help:
http://cookbooks.adobe.com/post_Close_event_of_browser_or_browser_tab-18211.html
Best,

Similar Messages

  • How to detect window close event and do some task before exiting

    Hi 
    Anyone knows how to detect window close event and do some task before exiting ?
    Sridhar
    Solved!
    Go to Solution.
    Attachments:
    window close event.JPG ‏34 KB

    Yes .You can discard the panel close event by passing "TRUE" boolean value to the "discard ?" terminal which is lied in the right side of that panel close(filter) event.& It will work in executables.  See attached picture.
    Attachments:
    Panel Close.JPG ‏12 KB

  • How to catch browser close event excluding navigation events

    Hi,
    I tried using onBeforeUnload event and onUnload events.. but they are catching navigation events within the same site. Could you please let me know how I can catch browser close events without catching Navigation events?
    Thanks.

    Just set them to null when navigation takes place.
    Said that, you should be asking Javascript/DHTML related questions in a forum devoted to Javascript/DHTML. There are ones at webdeveloper.com and dynamicdrive.com. This has nothing to do with Java.

  • 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

  • How to Detect browser crash

    hi i want to know how to detect browser crash or the way to go about it , i can use any language to any api's plz specify me some solution .It would be really healpfull

    paul_123 wrote: hi i want to know how to detect browser crash ..
    Like the other person that replied, I do not quite understand why it is of interest that the end user's browser crashes. If, like they suspect, it is to do with your applet, I think the best solution is to launch the applet using webstart and forget the browser. If the end user launches a webstart based applet from the browser and the browser crashes, the applet will keep working just fine.
    Is your applet publicly available? If so, what is the URL where we can see it?

  • 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

  • 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

  • How to handle form close event or escape key press event for user defined f

    Experts,
    Please let me know how to handle form close event or escape key press event for user defined form...
    Thanks & Regards,
    Pravin.

    Hi
    You can catch the form close event like this
    If ((pVal.FormType = 139 And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_CLOSE)) And (pVal.Before_Action = True)) Then
          Try
                   SBO_Application.SetStatusBarMessage(pVal.EventType.ToString())
          Catch ex As Exception
                    SBO_Application.SetStatusBarMessage(ex.Message)
            End Try
          End If
    Hope this helps
    Regards
    Arun

  • Confirmation of browser close event

    Hello,
    In my application, I have a function "myCloseFunction" which looks something like this:
    public function myCloseFunction
         Alert.show("This is an alert.");
         trace("myCloseFunction called");
    This is only called upon closing the browser (set up using ExternalInterface.addCallback and window.onbeforeunload)
    The strange thing is, no alert ever pops up BUT the trace does show.  I have (of course) imported the alerts library (and used alerts elsewhere successfully in the application).  Has anyone ever experienced it or does anyone know of a fix?
    I will post my Javascript and .mxml file if needed, though I doubt it is.
    Thanks in advance for your help!

    hi,
    Frastructed with the window close example using ExternalInterface.addCallback provided by Adove not working. Any help would truly appreciated.  here is what i've found:
    1. when tested, it passes data from html to Flex if I use onchange="callApp();" of the <Input> tag by typing something to invoke onchange event;
    2. if I choose to use window.onbeforeunload = callApp(); at the JavaScript section to detect window closing event, it does detect window is closing, but it won't pass the data ("Window Closing") to Flex. 
    Thank you very much for any help.
    In Html:
    <html><head>
    <title>wrapper/AddCallbackWrapper.html</title>
    <SCRIPT LANGUAGE="html/JavaScript">
       function callApp() {       
            window.document.title = document.getElementById("newTitle").value;       
            mySwf.myFlexFunction("Window Closing");
        //window.onbeforeunload = callApp();   
    </SCRIPT>
    </head>
    <body scroll='no'>
    <h1>AddCallback Wrapper</h1>
    Enter a new title: <input type="text" size="30" id="newTitle" onchange="callApp();">
    <table width='100%' height='100%' cellspacing='0' cellpadding='0'>
        <tr>
            <td valign='top'>
                <object id='mySwf' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab' height='200' width='400'>
                    <param name='src' value='testWrapper.swf'/>
                    <param name='flashVars' value=''/>
                    <embed name='mySwf' src='testWrapper.swf' pluginspage='http://www.adobe.com/go/getflashplayer' height='100%' width='100%' flashVars=''/>
                </object>
            </td>
        </tr>
    </table></body></html>
    In Flex:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
          <mx:Script>
              <![CDATA[              
              import flash.external.*;
              import mx.rpc.events.ResultEvent;
              import flash.events.Event;
              import mx.rpc.events.FaultEvent;    
              import mx.controls.Alert;
         public function initApp():void {
            ExternalInterface.addCallback("myFlexFunction",myFunc);      
         public function myFunc(s:String):void {           
            Alert.show(s);    
        ]]> 
      </mx:Script>
      <mx:Label id="l1"/> 
    </mx:Application>

  • Is it possible to detect browser information directly from FLEX????

    Hi All,
    Can we detect our browser information (Browser Name, Version
    etc) directly from FLEX? I don't want to use External Interface for
    this purpose. Pease reply me soon.
    Thanks,
    Amit

    Hi Amit,
    The replies from Gnomann are correct.
    Following the logic that Gnomann cited in his second post
    (suggesting using ExternalInterface to execute browser JavaScript),
    following are some examples.
    These examples also demonstrate how JavaScript methods can be
    written in-line directly in the ExternalInterface.call() execution:
    var appName:String =
    ExternalInterface.call( "function getAppName(){ return
    navigator.appName; }"
    var userAgent:String =
    ExternalInterface.call( "function getUserAgent() { return
    navigator.userAgent; }"
    var appVersion:String =
    ExternalInterface.call( "function getAppVersion(){ return
    navigator.appVersion; }"
    I have posted a different, runnable example here:
    http://flexflashvideo.com/codesamples/flex/flex3/browserinfo/
    You can right-click on the swf at the link above for "
    View
    Source"
    btw ... an advantage of writing the JavaScript methods
    in-line in the ActionScript ExternalInterface.call() executions is
    that all of the code can be encapsulated in the Flex logic. That is
    you do not have to write the JavaScript separately in the HTML
    wrapper. You can if you want, of course. Certainly no harm in that
    ;-) Since your original question was how to detect the browser
    information "directly from FLEX", I suspect you might like being
    able to write the JavaScript methods in-line ;-)
    Please post back regarding whether the above answers your
    question, and if you find it helpful :-)
    Best regards,
    g

  • How To Get The CLOSE Event In a JSP File?

    Hello everybody,
    Right now I am working in a JSP project which is about access log, when the users start , oprate, or close the system, the access log system works. I am in trouble in that when the users close the system, how can I get the close event?
    The JSP file contains the following fields :
    Close Window
    How to add code to get the CLOSE Event and submit to the service?
    And If I hit the "Close Button"(on the right-top of the window), how can I get the CLOSE event, too?
    Can anyone tell me?

    1. Add a hidden field:
    <input type="hidden" id="status" value="">2. modify <a href="index.jsp" onclick ="parent.window.close( );">Close Window</a> with <a href="index.jsp" onclick ="closefn();">Close Window</a>3. Add a javascript
    <script language="javascript">function closefn(){
    document.getElementById('status').value="close";
    document.form.action="";
    document.form.method="post";
    document.form.submit();
    parent.window.close( );
    }4. Now on the action page get the value of status by request.getParameter("status"); and log it.

  • How to detect Browser using JSP ?

    Hi friends,
    I wanna to put some code to detect browser and
    Other than IE6+ i have to block other browser to display login.
    How do i check that ? Using JSP.
    e.g.
    If i open IE6+ login page should be displayed. Else on other browsers
    it will check brower and deny to display login page.
    How Do i check it ? please Help me.

    this code works for me in IE,Safari and firefox but i could not check in netscape as i dont have.
    String userAgent = request.getHeader("User-Agent");
          System.out.println("UserAgent:"+userAgent);
          userAgent=userAgent.toLowerCase(); //convert to lowercase and then check
          if(userAgent.indexOf("netscape6") != -1)
         System.out.println("Netscape");
          else if(userAgent.indexOf("msie") != -1)
              System.out.println("IE");
         else if(userAgent.indexOf("firefox") != -1)
         System.out.println("Firefox");
         else if(userAgent.indexOf("safari") != -1)
         System.out.println("Safari");
         else
              System.out.println("Else");
        

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

  • How to detect browser window move?

    Hi,
    I want to know if there is certain event defined in Java to detect browser window move. Like in JavaScript, there is an event handler "onMove".
    Thanks.

    No, I think you can have "onMove" call a java function.

Maybe you are looking for