【问题标题】:GWT browser refresh issueGWT 浏览器刷新问题
【发布时间】:2010-09-21 09:35:52
【问题描述】:

在我使用 gwt2.1 开发的应用程序中,单击浏览器的刷新按钮会进入主页,并且令牌仍保留在 url 中,因此我的链接将不起作用.. 例如。假设我的链接是link1、link2、link3,而#link1、#link2、#link3 是各自的标记。现在点击link1 将有以下网址http://localhost:8080/myproject/home.htm#link1

      Clicking on link2 will have following url http;//localhost:8080/myproject/home.htm#link2 and so on for other links.

      Now the problem is : Suppose i click on link1 so my url will be http://localhost:8080/myproject/home.htm#link1 now when i click browser's refresh button it leads me to home page and my url will be still http://localhost:8080/myproject/home.htm#link1 i.e. the token still remains in the url because of which this link doesn't when clicked after refresh.

【问题讨论】:

    标签: gwt


    【解决方案1】:

    您是否在 EntryClass 的 onModuleLoad 函数中触发当前历史状态?

    只需添加

    History.fireCurrentHistoryState();
    

    这样做。

    【讨论】:

    • 是的,我在 onModuleLoad 函数中触发它。但我正在搜索的解决方案是:点击刷新让它转到主页,但 url 应该是 localhost:8080/myproject/home.htm 即令牌应该刷新后消失..
    • 对不起,我误会了。你试过 History.newItem("");在你的 onModuleLoad() 中?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-09
    • 1970-01-01
    • 2014-08-10
    • 1970-01-01
    • 1970-01-01
    • 2015-02-18
    相关资源
    最近更新 更多