我正在使用 Wicket 6.x
,但在使用 AjaxNewWindowNotifyingBehavior
时遇到了问题。
根据 Wicket 文档,这是它的作用:
An Ajax behavior that notifies when a new browser window/tab is opened with url to a page instance which is already opened in another window/tab in the same user session
基本上,它会在创建新窗口/选项卡时提醒您。
我的问题是它不能正常工作,因为它不仅在新窗口/标签上触发,而且当用户按下浏览器的“后退”按钮时,这显然是打乱了我的应用程序的逻辑。
如何避免这种情况?这是 Wicket 错误还是我做错了什么?以下是我的使用方式:
add(new AjaxNewWindowNotifyingBehavior("compila") {
private static final long serialVersionUID = 1L;
@Override
protected void onNewWindow(AjaxRequestTarget target) {
//Do whatever...
}
});
有什么想法吗?有什么方法可以检测该行为是由于新选项卡而不是按下后退按钮而触发的吗?
最佳答案
这是 AjaxNewWindowNotifyingBehavior 中的错误:
当“旧”页面呈现到其原始窗口中时,它会检测到一个新窗口,同时其名称已被另一个页面更改。
关于javascript - Wicket AjaxNewWindowNotifyingBehavior 和后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44006238/