You might want to consider following the approach used in Firefox for important popups, like the alert asking about installing an extension. (Someone blogged about it a while back.) Basically they disable the controls on the window and pop it up, and only re-enable the controls after a few seconds delay. That way the user sees it, the popup doesn't eat any unintended keypresses, and they get a chance to react safely.