Search code examples
c++webframeworkswidgetwt

Embed Wt based widget in a webpage as iframe?


Does anyone know if it is possible to embed Wt based widget in a webpage as iframe? Can multiple copies of same widget be embedded in given webpage (For example, a 3D viewer widget based on Wt, displaying gallery of multiple 3D models in same page)?


Solution

  • It's completely possible.

    You'd make WT::WApplication with your widget as a child of the root().

    In the iframe tag, you'd put the src="http://path.to.wt/app".

    You could pass stuff to it in the url (eg. http://path.to.you/app?view=22) or via cookies if it's the same domain: http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WEnvironment.html#a30810ecfa507bc6f655c38a6f218dc92


    To have multiple copies of the some widget you could use a witty container: http://www.webtoolkit.eu/widgets/

    I might not be understanding that second part of the question correctly.


    In fact you don't even need to use an iframe, you can do it with some java script, and a widget set: http://www.webtoolkit.eu/wt/doc/reference/html/namespaceWt.html#af4b6ed5fd28b4f5fa141b153c1107349