3

Nothing irritates me more than filling out an entire form full of data only to click a button that wants to open a pop-up window and IE having to refresh then entire page, causing me to lose everything I typed into the form.

WHY?

Does IE's pop-up blocker initially rewrite the source of a page or something so that scripts can't open pop-ups. Is that why it has to do a total refresh of the page when you tell it to allow pop-ups, so that refreshes without modifying the source to disable pop-ups?

Is there a way to tell IE that it can allow pop-ups from a page without it having to refresh?

7

TL;DR: Because web pages are actually applications and opening a pop-up when it's not expected to open can introduce undefined state.


Pop-ups are shown using JavaScript. Sometimes a script may expect some reaction from a pop-up window. When a browser blocks a pop-up, it must notify the script that something went wrong so it takes appropriate action. (Or it just cancels entire script, it's not important for this question)

If you open that popup later, it may want to react with the script that tried to show it. But the script execution has now ended and the application will enter a state that could never be entered in a normal application flow, so it's very likely that application can't handle it correctly. What can happen?

  1. Nothing. It's possible that nothing bad will happen, but you can't be sure.
  2. Scripts may break, making the application unusable until you refresh the webpage, or sometimes even until you clear your cookies.
  3. Something unexpected may happen, possibly creating a security flaw.

Exact results of opening a pop-up later can't be predicted programmatically, so IE is just preventing you from breaking something - if you reload a webpage, scripts will be processed again, but with pop-ups appearing in the right moments.

  • If what you say is correct (and I believe it is), the best solution to this would be for Microsoft to still download the pop-up window's HTML, but not show the window or parse the HTML until the user consents to the pop-up. After that, the application flow would resume and would probably be rather seamless. – oscilatingcretin Jul 21 '13 at 21:45
  • @oscilatingcretin then they would have to suspend all scripts on a page, because they don't know how they are reacting with each other. Things that would stop working include expanding menus, Facebook Login buttons, form verification scripts and so on. What's more, it wouldn't actually solve a problem, because suspending scripts doesn't suspend you - you can still edit forms etc, and application cannot track it, so it's possibly in the illegal state again. – gronostaj Jul 22 '13 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.