You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by samket <sa...@gmx.com> on 2016/10/06 18:14:24 UTC

embed Wicket application on any page

Hi,

Is it possible to embed a Wicket application on any page? A bit like Google Map. Lets say there is a div element on an arbitrary page and I use javascript to bring the Wicket application's front page inside that div. Naturally, I would make sure that the application uses AJAX for everything so that the browser's page does not change. Are there any difficulties in this approach? I can imagine session expiration might cause difficulties. The default session expired page causes a page reload which is unwanted.
 
-Sampo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: embed Wicket application on any page

Posted by Ravi <ra...@intellinet.de>.
Hi,

we developed a software that can be embedded on any html with a JS-Snippet. 
Though we had to overcome a few obstacles, we managed to get it working for
our use-case.

The embedding application can pass an URL as a parameter to which we
redirect in case of an expired session. That'll result in a page reload of
the embedding page.
Works if you have only one (embedded) page.

The <head> section of embedded pages seem to get handled pretty well by most
Browsers. We hadn't had any problems so far (Desktop & Mobile)

You have to enable CORS, of course.
And the conflicting JS gave us some trouble...



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/embed-Wicket-application-on-any-page-tp4675695p4675706.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: embed Wicket application on any page

Posted by samket <sa...@gmx.com>.
Thank you for the great answer! I'll have to think about our options. And probably read that interesting book.

-Sampo
 
 

Sent: Friday, October 07, 2016 at 9:55 AM
From: "Martin Grigorov" <mg...@apache.org>
To: "users@wicket.apache.org" <us...@wicket.apache.org>
Subject: Re: embed Wicket application on any page
Hi,

You are forgetting that:

1) A Page produces a <html><head>...</head><body>...</body></html>
You cannot put this into a <div>.

2) The Ajax urls are relative, i.e. they will be resolved against the
wrapping page, not against the embedded thingy.

3) Assuming that you produce just document fragments, i.e. render
components instead of pages and put them in a <div>, then they will most
probably depend on some CSS and/or JS resources. Those resources won't be
available unless you take special care to contribute them within the
component's markup.

4) Once you fix the CSS contribution it will be quite easy to break the
layout of the wrapping page. You may need to use Shadow DOM to prevent this.

https://manning.com/books/third-party-javascript - this book explains many
of the problems one will face when embedding in others web sites/apps.



Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov[https://twitter.com/mtgrigorov]

On Fri, Oct 7, 2016 at 6:16 AM, samket <sa...@gmx.com> wrote:

> My employer doesn't like iframes. It might be an issue to our customers
> too. Am I making things too difficult for myself by trying to use Wicket
> for this? Am I forgetting something vital? I'd like to hear opinions.
>
> -Sampo
>
>
>
> Sent: Thursday, October 06, 2016 at 10:15 PM
> From: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> To: "users@wicket.apache.org" <us...@wicket.apache.org>
> Subject: Re: embed Wicket application on any page
> Use an iframe?
>
> On Thu, Oct 6, 2016 at 8:14 PM, samket <sa...@gmx.com> wrote:
>
> > Hi,
> >
> > Is it possible to embed a Wicket application on any page? A bit like
> > Google Map. Lets say there is a div element on an arbitrary page and I
> use
> > javascript to bring the Wicket application's front page inside that div.
> > Naturally, I would make sure that the application uses AJAX for
> everything
> > so that the browser's page does not change. Are there any difficulties in
> > this approach? I can imagine session expiration might cause difficulties.
> > The default session expired page causes a page reload which is unwanted.
> >
> > -Sampo
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: embed Wicket application on any page

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You are forgetting that:

1) A Page produces a <html><head>...</head><body>...</body></html>
You cannot put this into a <div>.

2) The Ajax urls are relative, i.e. they will be resolved against the
wrapping page, not against the embedded thingy.

3) Assuming that you produce just document fragments, i.e. render
components instead of pages and put them in a <div>, then they will most
probably depend on some CSS and/or JS resources. Those resources won't be
available unless you take special care to contribute them within the
component's markup.

4) Once you fix the CSS contribution it will be quite easy to break the
layout of the wrapping page. You may need to use Shadow DOM to prevent this.

https://manning.com/books/third-party-javascript - this book explains many
of the problems one will face when embedding in others web sites/apps.



Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Oct 7, 2016 at 6:16 AM, samket <sa...@gmx.com> wrote:

> My employer doesn't like iframes. It might be an issue to our customers
> too. Am I making things too difficult for myself by trying to use Wicket
> for this? Am I forgetting something vital? I'd like to hear opinions.
>
> -Sampo
>
>
>
> Sent: Thursday, October 06, 2016 at 10:15 PM
> From: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
> To: "users@wicket.apache.org" <us...@wicket.apache.org>
> Subject: Re: embed Wicket application on any page
> Use an iframe?
>
> On Thu, Oct 6, 2016 at 8:14 PM, samket <sa...@gmx.com> wrote:
>
> > Hi,
> >
> > Is it possible to embed a Wicket application on any page? A bit like
> > Google Map. Lets say there is a div element on an arbitrary page and I
> use
> > javascript to bring the Wicket application's front page inside that div.
> > Naturally, I would make sure that the application uses AJAX for
> everything
> > so that the browser's page does not change. Are there any difficulties in
> > this approach? I can imagine session expiration might cause difficulties.
> > The default session expired page causes a page reload which is unwanted.
> >
> > -Sampo
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: embed Wicket application on any page

Posted by samket <sa...@gmx.com>.
My employer doesn't like iframes. It might be an issue to our customers too. Am I making things too difficult for myself by trying to use Wicket for this? Am I forgetting something vital? I'd like to hear opinions.

-Sampo
 
 

Sent: Thursday, October 06, 2016 at 10:15 PM
From: "Ernesto Reinaldo Barreiro" <re...@gmail.com>
To: "users@wicket.apache.org" <us...@wicket.apache.org>
Subject: Re: embed Wicket application on any page
Use an iframe?

On Thu, Oct 6, 2016 at 8:14 PM, samket <sa...@gmx.com> wrote:

> Hi,
>
> Is it possible to embed a Wicket application on any page? A bit like
> Google Map. Lets say there is a div element on an arbitrary page and I use
> javascript to bring the Wicket application's front page inside that div.
> Naturally, I would make sure that the application uses AJAX for everything
> so that the browser's page does not change. Are there any difficulties in
> this approach? I can imagine session expiration might cause difficulties.
> The default session expired page causes a page reload which is unwanted.
>
> -Sampo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


--
Regards - Ernesto Reinaldo Barreiro

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: embed Wicket application on any page

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Use an iframe?

On Thu, Oct 6, 2016 at 8:14 PM, samket <sa...@gmx.com> wrote:

> Hi,
>
> Is it possible to embed a Wicket application on any page? A bit like
> Google Map. Lets say there is a div element on an arbitrary page and I use
> javascript to bring the Wicket application's front page inside that div.
> Naturally, I would make sure that the application uses AJAX for everything
> so that the browser's page does not change. Are there any difficulties in
> this approach? I can imagine session expiration might cause difficulties.
> The default session expired page causes a page reload which is unwanted.
>
> -Sampo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro