history.back() is the equivalent of history.go(-1)
I'm doing history.go(0) which keeps you where you are. works in Mozilla, not in IE.
you're only prevented if hasChanged == 1, and also, I have a confirmation dialog, that I removed for clarity, so you can leave if you really want to.
oh yeah.. i fooled myself with the 0/-1 thing.
do you really have to prevent them from hitt Back? It would be a lot easier if you just checked hasDirty() when clicking on any submit buttons or UI links.
back isn't important, I need a way of preventing them from leaving the page when they:
1) click any link in the page
2) click any button in the page (except the save changes button, which will clear the dirty flag)
How would I do this? I can't add onClick()'s to every link in the page, because some of them are from an included page that has navigation links, and is used on pages where there is no dirty flag.