Hold ESC down for about two seconds, and you're out of most windows and browser tabs. This script notices the difference between being in and out of a browser; within, tabs are closed, not the browser itself. Other than that, it doesn't differentiate.
settimer, click, -100 ; 0.10 seconds (?)
WinGetTitle, Title, A
if (A_TickCount-KeyDown > 650)
If title contains Internet Explorer, Nightly, Aurora, Firefox, Google Chrome, Opera