Gmail seems to have some clever way of handling the back/forward buttons in a rich JS application.
In my organisation we trialled the jQuery history plugin. The plug
You might want to check this previous question :
Is there a way to catch the back button event in javascript?
It seems like the way it's done in jQuery is the only way to do it because that's what YUI is doing too :
http://developer.yahoo.com/yui/history/