I am trying to prevent users from inadvertently using the back button to access previous panels in an asp.net form.

The form is a single page which appears to be multiple pages.

If the user presses the browser back button I would like a confirm alert to appear giving the user the option to procede.

The javascript function I am using is fired by the OnUnload event.

function UnLoadConfirm() {
return confirm('Using the back button will clear the form!');

// if yes button is clicked proceed to previous page

//else do nothing