how to cancel a page change?

how to cancel a page change?

i have a page, when it is shown. i want to make sure some data are corrent. if not, i want to prevent it from being shown. since i do not know from where the change will come from. i need to attach a event handler to this page. (will be deprecated, but some people are fighting to keep it in)

so now i have tried
$("#page").on("pageshow"
"pagebeforeshow"
"pagebeforeload"

and in the handler i tried to return false, or e.preventDefault()

but somehow the page still show up.
is there a way for me to cancel a page being shown?

in javascript, a click on a checkbox can be cancelled by return false.

thanks a lot