5
votes

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.

1
The code seems to be fine. This appears to be an issue with Firefox. - blitzkriegz
Every issue I've had with Firefox not displaying my Silverlight objects has been solved by applying a height and width to the enclosing div. (not 100%, but numeric value) - bperreault

1 Answers

4
votes

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?