Firefox freezed with Silverlight

Yesterday I noticed my application used to freeze with Firefox and plugin-container.exe was running 100% of the dedicated cpu.
I managed to understand that this behavior it's due to the windowless parameter, which was set to TRUE for all browsers (needed for transparent background)

In windowless mode, the Silverlight plug-in does not have its own rendering window. Instead, the plug-in content is displayed directly by the browser window.

To solve this I needed to understand in which browser application is running. Here it's the code:
function detectBrowser(){
    var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;                         // Opera 8.0+ (UA detection to detect Blink/v8-powered Opera)
    var isFirefox = typeof InstallTrigger !== 'undefined';                                            // Firefox 1.0+
    var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;     // At least Safari 3+: "[object HTMLElementConstructor]"
    var isChrome = !!window.chrome && !isOpera;                                                        // Chrome 1+
    var isIE = /*@cc_on!@*/false || !!document.documentMode;                                        // At least IE6 - NOT Edge
}

<param name="windowless" value="document.write(isIE())" />

Commenti

Post più popolari