Reputation: 547
Now I am creating a GWT application and using jqm4gwt(jquery mobile) for mobile purpose. In this case, I would like to control the back button and forward button event from browser(browser built in button). For instance, after user login, I will show the menu screen of the application. In this case, user should not click back button for going to login page again.
Now I try to handle by GWT History mechanism,
History.addValueChangeHandler(
new ValueChangeHandler {
public void onValueChange(ValueChangeEvent<String> event) {
.....
}
});
But this event is occur at ever screen transition(both normal screen flow and back and forward button click) and this event is occur after creating the new JQMPage(this was created by login button click event).
I would like to know which is the best way for controlling this unwanted back/forward event.
Upvotes: 1
Views: 537
Reputation: 175
You can create new Session and maintain session attribute in cookies, when user click on login button. 1. If user click any button you can fire History token based on that, 2. If user refresh it will go to onModuleLoad() - Entrypoint there you can check session is there or not if session is there ? show main page or show login page 3. remove cookies when logout check this. http://varuntayur.wordpress.com/2012/01/25/session-management-in-gwt/
Upvotes: 1