Silverlight browsers bugs
Silverlight is one of those browser technologies that you just wish wasn’t there. Proprietary,buggy, not widely used, and difficult to implement. Unfortunately, sometimes you can’t live without it when you want to play, for example, Windows Media files in a browser.
While working with Silverlight i encountered quite a few bugs in its implementation in browsers, especially when working together with Javascript. Here are a few bugs i encountered and possible workarounds.
All these bugs are noticed when using Silverlight 4.
overflow:hidden / overflow:auto bug
Browsers affected: Firefox 4 (Mac / Win)
The bug: when you put the Silverlight <object> inside a div, every time you change the overflow property from hidden to auto (making scrollbars appear) the Silverlight object re-initializes. This is especially frustrating with videos, that start from the beginning.
The official docs actually have this wonderful explanation:
Because of browser differences, the Silverlight plug-in does not support the cascading style sheets (CSS)overflow property on the object element or on a parent container element, such as a div element.
Workaround: This only seems to happen when the overflow property is changed by a user action, such as with a :hover pseudoclass. When you ‘force’ the browser to hide the scrollbar the Silverlight object doesn’t restart. For example, when you set the height of the div to a very large height the scrollbar disappears but the object doesn’t restart.
Another workaround when you need a scrollbar is to use a custom Javascript solution. I recommend the excellent jScrollPane jQuery plugin.
Offscreen initialize bug
Browsers affected: All browsers on Mac (tested: Chrome, Safari, Firefox)
The bug: This Mac-only bug happens when you initialize the Silverlight object at a place that is not on-screen (for example to create an audio-only player that you don’t want to see) the object doesn’t initialize. When you scroll the object into screen (e.g. by using Firebug) the object starts.
Workaround: difficult. With an audio player you could put it in a div with position: fixed, but putting multiple ‘audio pixels’ on top of each other using z-index won’t work though.
Nils Breunese
Gelukkig heeft Microsoft een prachtig forum (?!) om Silverlight bugs te rapporteren: http://forums.silverlight.net/forums/28.aspx
Dima Halfer
Regarding the Offscreen initialize bug:
I have used {position:absolute; width:100%; height:100%; top:0; left:0; z-index:-1;} css for container with SL, and after SL loaded (in the onload callback) I have added {height:1px;width:1px;} css to the div container (it didn’t want to work with height:0;width:0 in my case and I do not know why).
This is surely not the only possible workaround, but it worked for me.