Preventing users from closing browser tab. Bad idea?

I have a customer who wants to add one of those annoying JavaScript alerts that prevent users from closing a browser tab to make them a discount offer. You know, something like:

"are you sure you want to leave this page? Click on 'stay on this page' and you'll get a free [whatever]".

I'm pretty sure that trying to retain a user that already decided to leave is a bad idea, for many reasons. Some will stay, but many others will be really pissed off.

But actually, I found no research or published articles about this subject. I mean, real user research, with data, not just opinions.

Your opinions, help, sources, links to articles with user data (not just opinions) would be very useful.

EDIT: In my case, the customer is an online shop and they want to keep users browsing the website. We're not protecting unsaved data, just trying to keep people "in the shop". BUt we're talking about keeping people in although they already decided to go out.

EDIT: Thanks everybody for taking the time to reply. So many answers, and so much common sense in your replies. Thanks a lot.