Tutorial :Silverlight getting loaded again and again in Firefox



Question:

I am using Silverlight.CreateObject function to create a object tag with a xap which is dynamic i.e. it does it on a click on something. And when u click that back again it gets disappeared. When u click it again, it should show the XAP again without loading it again(as it has been downloaded once). All works fine in IE. But in Firefox when I click it again, it starts loading it again. In fiddler it is showing Private Cache for both IE and Firefox. Can someone help me?


Solution:1

In firefox, when you hide a DOM element that contains a SL app, the SL application is re-initialized. we used jQuery to remove the object tag, then hide the element:

$("#element object").remove(); $("#element").hide();

...before you do show() you have to re-create the SL object tag. above applies also when replacing a DOM element with $.ajax loaded content.


Solution:2

Why are you adding this level of complexity? Why aren't you just setting the visibility style of the HTML DIV or OBJECT tag?


Solution:3

Could you try using the Silverlight.js 2.0 version from Microsoft. That might solve the caching issue?


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »