You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "zahir.kali" <za...@amdm.fr> on 2019/06/03 10:36:12 UTC
Close browser on button click
Hi,
I have a WebPage with an "Close" button. I would like to close the current
page on pressing the close button.
I tried with JavaScript function (see link
http://blog.e-svet.si/2013/05/closing-the-browser-window-from-wicket/) but
as the page is opened by Wicket, the browser forbids close the window by
using "window.close();".
Are there any way to do this using wicket ?
Thanks
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Close browser on button click
Posted by "zahir.kali" <za...@amdm.fr>.
Hi,
Thank you for the issu. This work with "Internet Explorer" but unfortunately
not with "Chrome" and "Firefox".
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Close browser on button click
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
What exactly did you try ?
Try with the following:
AjaxLink closeWindowLink = new AjaxLink("closeWindow") {
@Override public void onClick(AjaxRequestTarget target) {
target.appendJavaScript("self.open(location, '_self').close();");
}
}
On Mon, Jun 3, 2019 at 2:16 PM zahir.kali <za...@amdm.fr> wrote:
> I hade already tried this JavaScript wolution but it does not wotk. That is
> why i thinked that there is a full wicket solution like that exists on
> ModalWindow.close();
>
> --
> Sent from:
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Close browser on button click
Posted by "zahir.kali" <za...@amdm.fr>.
I hade already tried this JavaScript wolution but it does not wotk. That is
why i thinked that there is a full wicket solution like that exists on
ModalWindow.close();
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Close browser on button click
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
On Mon, Jun 3, 2019 at 1:44 PM zahir.kali <za...@amdm.fr> wrote:
> Hi,
>
> I have a WebPage with an "Close" button. I would like to close the current
> page on pressing the close button.
>
>
>
> I tried with JavaScript function (see link
> http://blog.e-svet.si/2013/05/closing-the-browser-window-from-wicket/) but
> as the page is opened by Wicket, the browser forbids close the window by
> using "window.close();".
>
> Are there any way to do this using wicket ?
>
Wicket doesn't do anything here. It is plain JavaScript. So better search
for javascript solutions in the web.
Try with this trick: open(location, '_self').close();
This triggers re-opening of the current page with a script and then
immediately closes it.
>
> Thanks
>
> --
> Sent from:
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>