You need to hide the standard Back button and replace it with a script button that does what you want. Either go back twice (or however many times is appropriate) or else use "/n".
Some people make this replacement button look like the standard one, some use a different label - mine look like this:
Steve.