views:

164

answers:

4

If there is a need to display some simple confirmation popup, most developers would rather install jQuery, find some dialog plugin for it, skin it, than put a one liner:

if(confirm("Are you sure?")) { ... }

Using alert() for displaying error messages is considered cheap.

And how many sites can you name that are usingprompt()?

So, the question is:

  1. Is there something wrong with those dialogs so they should be avoided? Yes they have (very) limited functionality and customization, but when you don't need anything fancy, is using js dialogs still a bad practice?

  2. Why these dialogs haven't seen any improvement in past 10 years (probably longer) and none is planned for near future? Wouldn't it be nice to have native js access to fully customizable desktop-level dialogs? At least adding error/warning/info type of dialogs and adding ability to customize button captions would be a big help.

A: 

Cuz they are ugly and disrupt the user experience by popping up a gray box out of nowhere. Its better to have a HTML dialog conforming to your website themes and look n feel

O yeah. and they are modal. This adds insult to injury

Midhat
+1  A: 

One of the resons why i do not use prompt or confirm or alert too much, is that they freeze all other browser UI. They dont allow the user to switch to another tab or do anything else w/o dismissing the dialog.

z33m
+9  A: 

alert displays a modal dialog box which effectively disables the browser UI until it is dismissed. Most developers consider that to be bad design and most users consider that irritating.

One of the main issues that I find with modal dialogs is that they don't let me open a new tab and do a quick Google search before responding to them.

Amarghosh
So why nobody ever considered adding non-modal option to them?
serg
There are plenty of HTML-based alternatives you can use.
Michael Petrotta
+1  A: 

On some browsers, alerts() can cause the page's tab to suddenly grab focus. Occasionally useful, mostly irritating.

Jim Blackler