You could just include the logo panel on the page and uses straight jQuery to show and hide the logo panel. You wouldn't need the Ajax timer and your extended OpenOnLoadModalWindow class. It should then be able to support the back button. You could also determine if the user has been to your app before in the same session and choose to show the logo or not (there are a few jQuery plugins that can help with determining that)
With Wicket 6 my understanding is that jQuery will be included by Wicket so this may be even easier to do in 6 and all in Java code. I have not looked at version 6 yet. On Jun 6, 2012, at 7:04 AM, Alex <zeita...@googlemail.com> wrote: > Dear All, > I have an application that on renderOnDomReadyJavascript shows Modal Dialog > for 5 seconds and then closes it. It is kind of Logo. Unfortunately if user > goes to another site and returns back then “Page expired” is displayed in > this Modal Dialog and it is not closes. Is it possible to avoid showing > this Modal Dialog after user returns to my application pressing “Back” > Button on the Browser or to show it properly for 5 sec. > Thanks a lot in advance, > Alex > > public class LogoStarter { > private static final Logger log = > LoggerFactory.getLogger(LogoStarter.class); > > public LogoStarter(final WebPage webPage) { > final ModalWindow modalLogo; > final ModalWindow modalInfo; > > webPage.add(modalLogo = new OpenOnLoadModalWindow("modalLogo")); > modalLogo.setTitle(""); > modalLogo.setPageCreator(new ModalWindow.PageCreator() { > private static final long serialVersionUID = > 2674999186672458996L; > public Page createPage() { > return new Logo(); > } > }); > > webPage.add(new AjaxLink<Object>("logo") { > public void onClick(AjaxRequestTarget target) { > if (target != null) { > modalLogo.show(target); > } else { > System.out.println("JS off"); > setResponsePage(new Logo(JS_OFF_MSG)); > } > > } > }); > > webPage.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) { > protected void onTimer(AjaxRequestTarget target) { > if (modalLogo.isShown()) > modalLogo.close(target); > stop(); > } > }); > } > } > > public class OpenOnLoadModalWindow extends ModalWindow implements > IHeaderContributor { > > public OpenOnLoadModalWindow(String id) { > super(id); > } > > public OpenOnLoadModalWindow(String id, IModel<?> model) { > super(id, model); > } > > public void renderHead(IHeaderResponse response) > { > response.renderOnDomReadyJavascript(getWindowOpenJavascript()); > } > > protected boolean makeContentVisible() > { > return true; > } > }