Detecting CardSpace support, including FireFox
Detecting support for CardSpace, or more importantly information cards in the browser is pretty important, as it would allow the web developer the opportunity to appropriately show the "sign in with your information card" button/link or other text as needed.
The following Javascript will return true if you have support for information cards.
function AreCardsSupported() { var IEVer = -1; if (navigator.appName == 'Microsoft Internet Explorer') if (new RegExp("MSIE ([0-9]{1,}[/.0-9]{0,})") .exec(navigator.userAgent) != null) IEVer = parseFloat( RegExp.$1 ); // Look for IE 7+. if( IEVer >= 6 ) { var embed = document.createElement("object"); embed.setAttribute("type", "application/x-informationcard"); if( ""+embed.issuerPolicy != "undefined" ) return true; return false; } // not IE (any version) if( IEVer < 0 && navigator.mimeTypes && navigator.mimeTypes.length) { // check to see if there is a mimeType handler. x = navigator.mimeTypes['application/x-informationcard']; if (x && x.enabledPlugin) return true; // check for the IdentitySelector event handler is there. var event = document.createEvent("Events"); event.initEvent("IdentitySelectorAvailable", true, true); top.dispatchEvent(event); if( top.IdentitySelectorAvailable == true) return true; } return false; } |