The goal is to get your Visual WebGui application to exist inside an IFrame with a known and correct DOCTYPE that works for Visual WebGui applications. Currently the DOCTYPE should be <! DOCTYPE html PUBLIC "-//W3C//DTD html 4.0 Transitional//EN">.
If you do not have control over the DOCTYPE of the IFrame your Visual WebGui application is enclosed in, then you can "wrap" the application in an Html where you specifically set the doc type. In that case you create an Html document with the above mentioned DOCTYPE at the top and in the body you place a <iframe src="/Form1.wgx" /> and adjust it as fit for your environment regarding width, height, style etc.
Then in your hosting application, you make it host the Html page, not directly the VIsual WebGui form. This will set the doctype correctly for the IFrame referencing the Visual WebGUI form and should work. It is indeed an extra layer of IFrame, but as you can't control the first layer's DOCTYPE, you need to change it for the Visual WebGui application to work.
Hope this helps,