Hi, Some things I would try are
1-Instead of a page use a panel for your modal. That way the page expired will not be shown on the page. 2-Make your page expired page the page you want to show. 3-AFAIK the method public void renderHead(IHeaderResponse response) { response.renderOnDomReadyJavascript(getWindowOpenJavascript()); } is the one determining the modal will be show on load. Yo can for instance use a more "permanent" cookie and don't call response.renderOnDomReadyJavascript(getWindowOpenJavascript()); depending on that condition. Regards, Melinda On Wed, Jun 6, 2012 at 1:04 PM, 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; > } > } >