Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a GWT widget that others can embed in their website?

I've created a widget in GWT and I would like to be able to give users a small snippet of HTML that they can embed in their website so my widget will be rendered there.

I don't believe an iframe would be appropriate as one requirement is that clicking any links on my widget should take the user to my website (not just change the content of the iframe).

Any help would be greatly appreciated.

P.S. I tried embedding the following, but no luck: < script src="http://embeddedapptest.appspot.com/embeddedapp/embeddedapp.nocache.js" >< /script > < div id="foo" / >

like image 668
Tom G Avatar asked Oct 29 '25 09:10

Tom G


1 Answers

It is possible. The snippet will need to be like

<script src="yourmodule.nocache.js"></script>
<div id="foo"/>

Then in your entry point do this:

RootPanel root = RootPanel.get("foo");
// add your things here. root.add(...);

You will need to be careful not to step on the outer page's styling and vice versa but compiled CSS should go a long way to helping that.

This is the technique used to embed an APIs Explorer in Google APIs documentation.

like image 94
Jason Hall Avatar answered Oct 31 '25 09:10

Jason Hall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!