简体   繁体   English

如何使用jqm4gwt在GWT应用程序中控制浏览器的后退按钮和前进按钮

[英]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. 现在,我正在创建一个GWT应用程序,并将jqm4gwt(jquery mobile)用于移动目的。 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, 现在,我尝试通过GWT历史记录机制进行处理,

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). 但是此事件在每次屏幕转换时都会发生(正常屏幕流以及后退和前进按钮单击都发生),并且在创建新的JQMPage(这是通过登录按钮click事件创建)之后发生此事件。

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. 当用户单击登录按钮时,您可以创建新的Session并在cookie中维护session属性。 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 ? 1.如果用户单击任何按钮,则可以基于此按钮触发历史记录令牌; 2.如果用户刷新它,将转到onModuleLoad()-Entrypoint,则可以检查会话是否存在? show main page or show login page 3. remove cookies when logout check this. 显示主页或显示登录页面3.注销时删除cookie选中此项。 http://varuntayur.wordpress.com/2012/01/25/session-management-in-gwt/ http://varuntayur.wordpress.com/2012/01/25/session-management-in-gwt/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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