The reason that it doubles up on firefox is because you call it twice ..

to fix...


if(!confirm('................')) {
Event.stop(evt);
}

Alex Mcauley
http://www.thevacancymarket.com
----- Original Message ----- 
From: "BillSaysThis" <bstgro...@gmail.com>
To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
Sent: Friday, November 13, 2009 6:27 PM
Subject: [Proto-Scripty] beforeunload event help


>
>  document.observe('dom:loaded', function() {
>    Event.observe(window, 'beforeunload', function(evt) {
>      if( !( $F('verifiedURL') ) ) {
>        var r= confirm("You have not tested your medallion, a step
> required for activation. You can return later by clicking the Manage
> button for this site.\n\nDo you still wish to leave?");
>        if(!r) {
>          Event.stop(evt);
>        }
>      }
>    });
>  });
>
> Having two problems with this code:
>
> 1. Ignores the value of $F('verifiedURL') and never shows the confirm
> dialog
>
> 2. If I comment out the if($F('verifiedURL')) test on Firefox a
> Confirm dialog is shown twice if I click Cancel, once with my message
> and then again with a generic message (but only once if click OK)--in
> both cases the browser takes the right action in the end.
>
> On Safari the dialog is only shown once but unloads the page no matter
> which answer is clicked.
>
> Generic message shown is:
>
> "Are you sure you want to navigate away from this page?
>
> Press OK to continue, or Cancel to stay on the current page."
>
> Using the Prototype lib shipped with Rails 2.3.4 on OS X 10.5.x.
>
> Thanks,
> Bill
>
> >
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to