changing unloadConfirmation message for modal windows in Apache Wicket
If you close the window when using ModalWindows in wicket, you get this message:
"Reloading this page will cause modal window to disappear"
Is there a way to configure this to show OTHER message? (for i18n purposes) Thanks a lot!!
M开发者_开发百科anuelYou can dismiss the modal window message by setting the Javascript variable Wicket.Window.unloadConfirmation
to false
and provide your own handler on window.onbeforeunload
.
So you have to set the following Javascript in your pages :
Wicket.Window.unloadConfirmation = false;
window.onbeforeunload=function(){
return I18n("yourI18nKey");
}
That is a browser dependent message and not a wicket message.
I believe Chrome and IE will show the one you pointed out.
Firefox 4 shows "This page is asking you to confirm that you want to leave - data you have entered may not be saved.".
I found out another, quite common way to get that warning when developing a modal view: if you happen to get this confirmation box by accident, it may be an indication of error in your code (Exception on log) and fixing the error also fixes the show of this message.
Good to note is that the confirm box is only an indication of error, not the cause of error itself. The error is elsewhere.
Source: http://ttlnews.blogspot.fi/2010/07/lessons-learned-wicket-spring-hibernate.html
精彩评论