Sorry for the mess on the last send... Whew! Here is a script that works on
most OS/Browsers... Drop in and enjoy!

    if ( window.Event ) {
    
        window.onbeforeunload = function( event ) {
            
            return confirmClose( event );
        }
    }
    else {
    
        window.onbeforeunload = function() {
        
            return confirmClose( event );
        }
    }

    function confirmClose( e ) {
    
        var promptString = 'Exit?';
        return( promptString );
    }


Rick Winscot



On 7/30/08 2:37 PM, "gjessup1" <[EMAIL PROTECTED]> wrote:

>  
>  
> 
> I'm having some issues with catching a browser exit with firefox. I
> can get it to work with IE (not exactly how I'd like, but it works).
> Does anyone have a good working example available...here is my code if
> you can help from that.
> Thanks
> 
> Greg
> 
> My javascript looks like this:
> script language="JavaScript" type="text/javascript">
> <!--
> alert ("This is a Javascript Alert"); //just a message which will be
> removed
> 
> // Give user a chance to save modified data
> window.onbeforeunload = function() {
> var warning="";
> var fxControl = document.SharedObjectBoard || window.SharedObjectBoard;
>  if (!${application}.unsavedAlert())
>  {
> warning = fxControl.getUnsavedDataWarning();
>  }
> 
> if (typeof fxControl.getUnsavedDataWarning=="function") {
> warning = fxControl.getUnsavedDataWarning();
> }
> if (warning!="")
> 
> return warning;
> else
> 
> return;
> }
>  -->
> </script>
> 
> in my init I have ---
> 
> if ( ExternalInterface.available ) {
>  
> ExternalInterface.addCallback("getUnsavedDataWarning",unsavedAlert);
> 
> Here are the functions triggered:
> 
> private function unsavedAlert():String {
>  Alert.show("Do you want to dave?", "Save Alert",
> Alert.YES|Alert.NO ,this,SaveAlertHandler,null,Alert.YES);
>  //Alert.show("function");
> if (commitRequired) return UNSAVED_DATA_WARNING;
> else return "";
>  }
>  
>   private function SaveAlertHandler(e:Event):void {
>      
>       Alert.show( e.type.toString());
>   }
> }
> 
>  
>     


Reply via email to