For this issue’s Tip or Trick, Servoy would like to thank Darren Clarke and The Support Group for their contribution – the HTML “iframe” tag.
“The why of iframes”
Have you ever wanted to embed a Servoy Web Client solution into an existing web page? Perhaps you want to hide Web Client’s complex URLs from your users or display media inline in one of your Servoy solutions. All of these things can be accomplished by using the HTML
The
A similar idea could be used to embed a full-sized Servoy application in a frame, which would give a clean-looking URL in the browser location bar instead of the verbose Apache Wicket URLs that are standard in Web Client. Even better, in most browsers the back button will continue to work as expected for the embedded page. The full contents of the parent web page would look like this:
Your title
Take this code, place it in an .html file, fill in the correct IP address / solution name and put the file on your web server (or in /Servoy/server/webapps/ROOT/ where Servoy’s internal web pages are hosted). When you give out the location of your application to users, simply tell them the location of this “shell” page.
The
This technique could also be used to embed an entire .pdf viewer in your solution:
Using iframes, you can take advantage of all of the native abilities of your browser of choice and bring those capabilities into your Servoy Web Client solution.
I just had the occasion to use my above suggestion and it did not work. The revised code below should work:
<html>
<head>
<title>Your Title</title>
</head>
<body style='margin:0px; padding:0px;'>
<div style="text-align:center;">
<iframe src="your-ip-address:8080/servoy-webclient/solutions/solution/your-solution-name" height="100%" width="680px" scrolling="no" frameborder='0' marginwidth='0px' marginheight='0px' style='margin:0px; padding:0px; border-size:0px;'>Place warning text here for browsers that do not support iframes.</iframe>
</div>
</body>
</html>
An important change is that the div tags need to be used. Also, the width of 680px represents the width of my widest Servoy form. Alternatively, a percentage width such as 70% or 80% could be used.