I didn't think there was much I could do to stop this from occurring - but a post from the 4 Guys From Rolla helped!
var needToConfirm = true;
window.onbeforeunload = confirmExit;
return 'Do you want to save before exiting?';
needToConfirm = false;
<asp:Button ID="btnSaveOrder" OnClientClick="needToConfirm = false;" runat="server" OnClick="btnSaveOrder_Click" Text="Save Order" />Now if the user tries to navigate away from the page without first hitting save or cancel they get the following pop up:-
Click OK and they navigate away as before, click cancel and they stay on the page - perfect!
Hope this helps!
This has been tested on IE6, IE7, and Firefox - no idea if this works on Safari or Opera