禁用GWT中的后退按钮 [英] Disable back button in GWT

查看:107
本文介绍了禁用GWT中的后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在GWT中禁用浏览器中的Back按钮(基本上清除History token栈)?一旦我浏览到应用程序中的某个页面,我想确保用户不能使用后退按钮返回,但只能使用页面上的链接来浏览网站。

解决方案

您无法禁用按钮,只是将其拦截并将其返回更改为浏览器无法理解的内容。



这消除了历史:

  Window.addWindowClosingHandler(new ClosingHandler (){
@Override
public void onWindowClosing(ClosingEvent event){
event.setMessage(My program);
}
});

要了解它,请参阅: http://groups.google.com/group/google-web -toolkit / browse_thread / thread / 8b2a7ddad5a47af8 / 154ec7934eb6be42?lnk = gst& q = disable + back + button#154ec7934eb6be42 然而,我会建议不要做这是因为它违背了良好的用户界面实践。相反,您应该找出后退按钮不会导致代码出现问题的方式。


Is there a way to disable the Back button in a browser (basically clearing the History token stack) in GWT? Once I browse to a certain page in my application I want to make sure that the user can't use the back button to go back, but only be able to use links on the page to navigate the site.

解决方案

You cannot disable a button just intercept it and change its return to something the browser does not understand.

This removes the history:

 Window.addWindowClosingHandler(new ClosingHandler() {
     @Override
      public void onWindowClosing(ClosingEvent event) {
      event.setMessage("My program");
      }
    }); 

To understand it see: http://groups.google.com/group/google-web-toolkit/browse_thread/thread/8b2a7ddad5a47af8/154ec7934eb6be42?lnk=gst&q=disable+back+button#154ec7934eb6be42

However, I would recommend not doing this because your it goes against good UI practices. Instead you should figure out a way that the back button does not cause a problem with your code.

这篇关于禁用GWT中的后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆