TMS Web application as plugin in another web site

I'm in need of some tips: How to make a TMS Web Application project to be included as a plugin in another web client? And how to exchange data between the parent web client with the plugin client?

I would think the simplest way would be to run it in an IFrame.

I guess so. I thougth IFrame was kind of old school. But it still seems to be the way to do it.

Do you know how it can be handled to send and catch data input from parent page to the TMS Web Application? And the other way?
Seems to be something about handling messages beetween each client's window object, and adding event listeners to be able to catch the communication (Communication between an iframe and its parent window - HTML DOM). How to do this in a TMS Web Application?

You could do this using an asm section in WebCore

asm
 window.parent.postMessage(amessage, '*');
end;

So there are no functionality in TWebForm class or the global Application object that can take care of these kind of messages? I must write javascript in a asm code section both for receiving and sending, I guess.

But maybe it can be done quite differently, without using IFrame at all.
Maybe I can make my TMS web code pluggable by setting the FormContainer property to a dedicated ID for the <div> that will contain the plugin, and then the parent html page contains what is needed to run the TMS web application as a sub content in the web site. This will also be a kind of plugin that can be used on other websites. Then my customer needs to include <tms web application project>.js and other necessary stuff in the main html file. Then no need to use messages (can access js object/functions directly instead). I have not tried this yet, but I guess this will work fine.

Passing data back and forth from an application running in an <iframe> is definitely a lower-level kind of thing, where a bit of JavaScript in an asm...end block is likely unavoidable. You can check out this blog post where a fairly complex web application is run inside an <iframe> embedded in a TWebHTMLDiv component in a TMS WEB Core app. Sort of the reverse of what you're doing, perhaps, but maybe a good example of how the communications works.

Not really all that much fun, to be honest, but it works. Generally, the hosting page doesn't have access to the contents of the <iframe> page for all kinds of security reasons, so we have to resort to this message-passing mechanism.

If you have access to the hosting page (or can instruct your customer how to change it), then there are more possibilities, as you're suggesting. Depending on the complexity of the hosting page, you could even craft a TMS WEB Core app to replace it entirely by just including it in your app. Doesn't always work, but perhaps something to consider in simpler situations.