You can embed one or more MobileTogether solutions in a webpage. Each solution is embedded in an HTML IFrame element. To embed, do the following:
1.Add the HTML IFrame element at the location in the webpage where you want to display the solution (see example below)
2.Set the src attribute of IFrame to the URL of the solution on MobileTogether Server that you want to embed (see listing below)
<iframe src="http://localhost:8083/run?d=/public/my-mt-solution" frameborder="0"></iframe>
When the HTML page is loaded, its IFrame element will load the targeted solution. Since the IFrame will access MobileTogether Server, three authentication-related scenarios are possible:
•Anonymous access: If anonymous access to the solution is enabled on MobileTogether Server, then the solution will be displayed directly in the IFrame; no authentication of the user is required. To set anonymous access, the server needs to (i) allow anonymous login (see the server settings for mobile client ports), and (ii) permit anonymous use of the solution (by setting the permissions of the workflow's container to a minimum of container=read and workflow=read,use).
•User login: If anonymous user login is not enabled on the server, then the user will be prompted to provide valid MobileTogether Server login credentials. If the user has permission to access the targeted solution, then the solution will be downloaded from MobileTogether Server to the IFrame of the webpage.
•JWT authentication: The user is authenticated in a system outside the MobileTogether Server authentication system, and the authentication information is passed to MobileTogether Server via JSON Web Tokens (JWT). JWT authentication enables the targeted solution to load without requiring MobileTogether-specific authentication.
The HTML code listed below shows how an IFrame element is used to embed a solution. Below the listing is a screenshot of the HTML page containing the embedded solution (framed in green). The solution used in this listing is a sample named About that is packaged with MobileTogether Server; it is located by default in the server's public container. In order to correctly embed this solution, set up the server to allow anonymous access of the About workflow. You can try out this feature by copying the HTML code below and saving it to file, and then opening the file in a browser.
<title>Webpage containing an embedded solution</title>
<h1>Webpage containing an embedded solution</h1>
<p>The embedded solution is loaded into an IFrame, which is located immediately below this paragraph.</p>
<iframe src="http://localhost:8083/run?d=/public/About" frameborder="0"></iframe>
The URL in the src attribute must resolve to the following pattern: