Live data from Hacker News

Ask HN: Why do browsers still support pop up dialogs and other bad behavior?

news.ycombinator.com

11–20 of 84 posts

Re: Ask HN: Why do browsers still support pop up dialogs and other bad behavior?

#11
post #2

Quite simply because browsers are not just used for websites but as an application platform as well. Depending on the design and the requirements of an application modal dialogues and in rare cases even disabling leaving via the back button absolutely make sense. It might not amount to good UX practices but it's not malware or a dark pattern either. Besides, if at all possible most browser vendors try to be backward…

>Depending on the design and the requirements of an application modal dialogues and in rare cases even disabling leaving via the back button absolutely make sense.

Sorry, I disagree with you. On a typical non-web application, a modal dialog doesn't prevent me from accessing other applications. It doesn't prevent me from forcefully killing crapware either. The idea that web applications should be able to break user expected control at the browser level is silly.

Browsers have Back, Forward, Refresh, Stop buttons, Tabs, cookie prefs, DNT prefs etc. Anything contained in a browser should respect these things. Browser devs should enforce this as browsers become more and more like their own operating systems.

Re: Ask HN: Why do browsers still support pop up dialogs and other bad behavior?

#12
Pages rely on window.open() for all sorts of non-popup things. You can't just break window.open(), or sites like DDG will stop working.

Not that there aren't ways to fix this, but in general "remove the offending API" rarely works on the Web. You need a more subtle approach.

Re: Ask HN: Why do browsers still support pop up dialogs and other bad behavior?

#13

Pages rely on window.open() for all sorts of non-popup things. You can't just break window.open(), or sites like DDG will stop working. Not that there aren't ways to fix this, but in general "remove the offending API" rarely works on the Web. You need a more subtle approach.

I think OP is rather talking about window.{alert,prompt,confirm}, at least "ie, you can't interact with the page without answering the dialog" hints towards that

Re: Ask HN: Why do browsers still support pop up dialogs and other bad behavior?

#14
post #8

It's not possible to prevent applications from creating modal dialogs and still allow them to be usefully interactive. If you took away `alert` and friends, sites would (and do) just create dialogs with HTML instead. If you want websites to be able to be dynamic at all, then they can use that power to be annoying. Two sides of the same coin. (the history thing seems like it might be more addressable)

Except my point is I'm completely okay with this because its not modal at an application level if its HTML. I just want to be able to leave the site. Change the way the page is rendered all you want, disable interactivity etc but I don't feel a website should be able to prevent me from closing it which is what a modal dialog does.

The most common use for onwindowunload dialog boxes is to warn the user of unsaved changes and prevent their loss.

Our web app autosaves so the dialog box should never appear, but our metrics show that it appears surprisingly often -- sometimes it can take a few seconds for changes to flush through the websocket, and for the save to get acknowledged.

If you took that away, our users would lose changes. I imagine they would get pretty irate.

Re: Ask HN: Why do browsers still support pop up dialogs and other bad behavior?

#15
The other answers given give the high-level view, but one technical detail to add: the semantics of alert() are that it blocks the execution of JavaScript. In old browsers that means across all tabs because that was how they were implemented.

Modern browsers are capable of running separate JS contexts, but doing so breaks backwards compatibility in a corner case: if you have the same domain open in two tabs, an alert() on one should block processing in the other. Otherwise, interacting with the other could change shared JS state while the code assumed it was blocked.

Concerns about this led to many discussions about designs where you would need to mark all tabs that were grouped together into blocks waiting for the modal to close, which are very difficult for users to understand. (I never quite understood why this hypothetical race was such a worry but people who knew more about web compat than me said that it was actually important, that sites relied upon this.)

Re: Ask HN: Why do browsers still support pop up dialogs and other bad behavior?

#17

Earlier quoted context omitted.

Except my point is I'm completely okay with this because its not modal at an application level if its HTML. I just want to be able to leave the site. Change the way the page is rendered all you want, disable interactivity etc but I don't feel a website should be able to prevent me from closing it which is what a modal dialog does.

The most common use for onwindowunload dialog boxes is to warn the user of unsaved changes and prevent their loss. Our web app autosaves so the dialog box should never appear, but our metrics show that it appears surprisingly often -- sometimes it can take a few seconds for changes to flush through the websocket, and for the save to get acknowledged. If you took that away, our users would lose changes. I imagine they…

If this is absolutely necessary, you can force the site to request permission to do this, just like getting location.

Re: Ask HN: Why do browsers still support pop up dialogs and other bad behavior?

#18
post #3

Safari has actually changed behaviour so alert/prompt/confirm dialogs are not modal outside of the tab - you can switch to other tabs and I believe even close the window/tab. They've also been restyled to make it obvious they're a prompt from the website not from safari itself. Also, there are legitimate uses for this functionality, so as with many things I think the solution is not to remove the functionality, just…

This is also the way prompts happen on mobile Safari and iOS.

Re: Ask HN: Why do browsers still support pop up dialogs and other bad behavior?

#19

Earlier quoted context omitted.

> Safari has actually changed behaviour so alert/prompt/confirm dialogs are not modal outside of the tab - you can switch to other tabs and I believe even close the window/tab. Firefox does this too.

http://i.imgur.com/WIeUFTN.png

... and now click on another tab.
Post reply on HN