Alert title? true!



  • Trying to close a G+ tab:

    Free Image Hosting at www.ImageShack.us

    Apart of the "true" title, I find it annoying that they even ask me if I'm sure even after I managed to click on that small x icon on the tab.



  •  The beforeunload is an annoyance, but the "true"bit comes from the part of its message that you're allowed to customize. And they fucked that up.



  • I'm amused that this dialog asks an actual yes/no question yet has descriptive buttons.

    An interesting twist on the usual "ask a complex question that cannot be answered yes/no, but only give yes/no buttons."



  • @too_many_usernames said:

    I'm amused that this dialog asks an actual yes/no question yet has descriptive buttons.

    That way, you don't have to read the message but can usually go just by the button titles. Far easier than seeing "Yes", "No" and "Cancel" and then having to go and read what it is the program is nagging you about.



  • @Gurth said:

    That way, you don't have to read the message but can usually go just by the button titles. Far easier than seeing "Yes", "No" and "Cancel" and then having to go and read what it is the program is nagging you about.
     

    Thank you, Captain.



  • If it was anyone but Google I'd suggest their code looked like this:

    $(window).bind('beforeunload', function(){
        if (SomeCounterGlobalThing){
            // don't let them leave while still doing the global thing!
            return false;
        } else {
            // ok you can go
            return true;
        }
    });
    


  • @MiffTheFox said:

    If it was anyone but Google I'd suggest their code looked like this:


    [...]

    Had to implement something similar on a booking confirmation page once. Idiots Users would see their booking details and think "ow, allrighty then!" and navigate away without actually confirming the booking (despite two pretty big buttons to that affect, one at the top and one at the bottom of the page). Add a confirmation dialogue upon leaving the page and invalid booking reports dropped to pretty much zero.

    Sure, it's not pretty, but it works.



  • @FragFrog said:

    Had to implement something similar on a booking confirmation page once. Idiots Users would see their booking details and think "ow, allrighty then!" and navigate away without actually confirming the booking (despite two pretty big buttons to that affect, one at the top and one at the bottom of the page). Add a confirmation dialogue upon leaving the page and invalid booking reports dropped to pretty much zero.

    Sure, it's not pretty, but it works.

    Well there's nothing wrong with the concept, but the problem with the code I posted was the implementation. Onbeforeunload handlers are supposed to return a string, which is displayed as a message with a confirm, or void to not ask the user and just leave the page. If true were returned, Javascript would interpert that as the string "true" and then a message like the original wtf would be displayed. This is contrary to all the other events in DOM, which expect a boolean. (Or depending on the implementation, it might ignore the return value and will cancel the event if e.preventDefault is called. Or maybe event.preventDefault. Thank god for jQuery spackling.)


Log in to reply