It overwrites the JavaScript function on the current page which triggers 
when you try to leave the page.
If the popups are appearing when you're closing the browser, executing 
that bit of code before closing the browser should prevent popups from 
appearing in the first place, assuming it's JavaScript that's doing 
that.

I got it from this page: http://watirwebdriver.com/javascript-dialogs/
I've used it myself on a few pages which trigger events when you try to 
close them, works like a charm :)

-- 
Posted via http://www.ruby-forum.com/.