Whenever we make use of large number of custom pages in our customization it is very usual to see the crashing issues on back and forward buttons.
Normally what happens is, whenever we make use of custom pages we need to create our custom URL’s for the same. Due to this sometimes we may face the problems in redirecting to this page from the standard one. Also we face the similar problem clicking on the “New” button.
You can write a below given script on every custom page where you face these kind of problems.
This takes into consideration that the action value for the back button is 521 and for the new button it is 1201.