问题描述
我正在创建一项功能,以防止用户重新加载页面或按下退格键或按下浏览器的后退按钮。
$ wnd.beforeunload = function()
{
return你好;
}
它只使用java脚本,但不能使用jsni。我还用过
$ p $ Window.addWindowClosingHandler(新的ClosingHandler()
{
@Override
public void onWindowClosing(ClosingEvent event)
{
event.setMessage(Are you sure?);
}
});
这是与页面refreh和关闭,但不与浏览器和退格键的后退按钮一起工作。 .pleace HELP ..
我已经在相同的上下文中发布了答案。
$ b $ -gwt?answertab = votes#tab-top> promt用户退格和浏览器后退gwt b
尝试使用任何选项:
-
History.addValueChangeHandler
-
WindowClosingHandler
-
Event.addNativePreviewHandler
-
$ wnd.onbeforeunload
I am creating a function that prevent the user when he reload the page or press a back space or press back button of Browser . i try the following code..
$wnd.beforeunload=function()
{
return "hello";
}
it is working with simply java script but not in jsni . i also used
Window.addWindowClosingHandler(new ClosingHandler()
{
@Override
public void onWindowClosing(ClosingEvent event)
{
event.setMessage("Are you sure?");
}
});
this is working with page refreh and closing, but not working with back button of browser and backspace ...pleace HELP..
I have already posted an answer in the same context.
Try with any option:
History.addValueChangeHandler
WindowClosingHandler
Event.addNativePreviewHandler
$wnd.onbeforeunload
这篇关于我们如何在GWT中使用onbefoerunload的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!