Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox doesn't show dynamically added Silverlight 5 control

My Silverlight 5 application hosted in an ASP.NET panel is not getting displayed in Firefox (version 11). However it works perfectly well in Chrome, IE and Safari. I am dynamically loading the Silverlight object as shown below. This is done to pass init parameters. (which I removed for testing). I am getting a small white blank Silverlight area in place of the Silverlight application in Firefox.

HtmlGenericControl myHtmlObject = new HtmlGenericControl("object");
myHtmlObject.Attributes["data"] = "data:application/x-silverlight";
myHtmlObject.Attributes["type"] = "application/x-silverlight";
HtmlGenericControl mySourceParam = new HtmlGenericControl("param");
mySourceParam.Attributes["name"] = "source";
mySourceParam.Attributes["value"] = "ClientBin/SilverlightApp.xap";
myHtmlObject.Controls.Add(mySourceParam);
HtmlGenericControl myOnErrorParam = new HtmlGenericControl("param");
myOnErrorParam.Attributes["name"] = "onError";
myOnErrorParam.Attributes["value"] = "onSilverlightError";
myHtmlObject.Controls.Add(myOnErrorParam);
myHtmlObject.Attributes["width"] = "100%";
myHtmlObject.Attributes["height"] = "100%";
panelSilverlightHost.Controls.Add(myHtmlObject);

However the HTML source from the various browsers look the same.

Page html from Firefox:

<object data="data:application/x-silverlight" 
    type="application/x-silverlight" width="100%"
 height="100%">
    <param name="source" value="ClientBin/SilverlightApp.xap"></param>
    <param name="onError" value="onSilverlightError"></param>
</object>

This is exactly same as in Chrome, IE and Safari.

I have tried other sample SL 5 applications (not dynamically loaded though) and these work fine on Firefox.

I tried different versions of Firefox on different machines. It is not helping. Any suggestions on what could be wrong here would be very helpful.

like image 906
csharper Avatar asked Oct 08 '22 07:10

csharper


1 Answers

The data attribute there is an invalid data: URI, so nothing gets loaded. Does using a valid URI (needs at least a comma after the type) help?

like image 163
Boris Zbarsky Avatar answered Oct 13 '22 10:10

Boris Zbarsky