Thursday, April 9, 2009 1:22 AM
Typically, if Silverlight isn’t installed for the user’s browser, they see this:
…or something like that. But what if you don’t want that to display? Maybe you want to actually replace an area with alternate markup, javascript, etc. when Silverlight isn’t available? Or maybe you want to just have your own message letting them know that Silverlight needs to be installed.
There’s a built in way to handle this with the Silverlight control. Below is my Silverlight application running in IE:
Now, what if someone doesn’t have Silverlight installed? They won’t be able to feast their eyes upon the glory that is the Hoff abiding! In the markup for my ASP.NET page, I can alter what gets displayed to give it more of a hoff-like feel:
Within the Silverlight control tag, I specify a PluginNotInstalledTemplate. This tag holds whatever markup I want to be used in the scenario where Silverlight isn’t installed. I don’t have to do any sort of javascript check or funky coding to determine this, the control takes care of that heavy lifting for me.
So when I disable Silverlight in my browser and run the page, the alternate image I specified will be displayed as a link to the Silverlight.net website.
Voila!
[Edit: Found a great blog post by Greg DeRoeck on how to leverage the PlugInNotInstalled template within SharePoint. Check it out here.]
D