Javascript : Alert Box dismissed when tabs switched

Viewed 4257

How not to allow Alert Box to be dismissed when tabs switched.

Using alert("Test"); on Google Chrome, when you switch tabs, the alert dialog box disappears, and when you're back on the same tab you have full access.

What I want is to do the same thing as stackoverflow website when you create a question and try to close the tab, there's a dialog box that pops up that doesn't allow you to go anywhere until you choose between (Leave or Stay).

IE and Firefox work differently, I mean block the tab when using alert("Test"); statement but Google Chrome doesn't block.

I sent a bug report to Google but they replied to me that : This is working as intended, see Issue 629964. It's not a security bug; a user could make the dialog box disappear with developer tools or myriad other tricks as well.

1 Answers

I was able to get around this issue by calling my javascript alert in an iframe

Related