I have a .NET 2.0 app (using C#) that shows some dynamically constructed HTML pages, some of which contain Silverlight. Here's a simple example of the HTML (Note, I am using absolute paths):
<html>
<head></head>
<body>
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="file:///c:/foo/bar/test.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="yellow" />
<param name="minRuntimeVersion" value="4.0.50401.0" />
<param name="autoUpgrade" value="true" />
</object>
</body>
</html>
If I have my WebBrowser Control load a local file containing this, it works fine:
WebBrowser browser = new WebBrowser();
browser.Url = new Uri("file:///C:/foo/bar/simpleExample.html");
However, if I set DocumentText using the exact same HTML, the Silverlight app won't load. It appears the plugin loads (if you right click, it'll say "Silverlight"), but the content does not. I'm using a very simple Silverlight app.
WebBrowser browser = new WebBrowser();
browser.DocumentText = "<html>...same HTML as above...</html>
I would greatly prefer to use the latter method and not have to use local files. Any idea why I would see these differences? I also tried the same situation using Silverlight.js to have Javascript dynamically embed Silverlight but got the same result.