Nope -- "works as designed."
Back in the day, a lot of websites would abuse onbeforeunload
to do things like -- reload the current page, open up a slew of pop-unders or just cancel the navigate away.
Now -- there is a semi-controllable action that you can do. Using Javascript, you can connect to every link
on the page and open your dialogue box and ask what they'd like to do. That may catch some of your needs, but it wouldn't catch people opening a bookmark, clicking the back
button or typing in a new URL.