简体   繁体   中英

How to control the back button and forward button of browser in GWT applicaton using jqm4gwt

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.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM