Perché InfoCards non funzionano in IE8?
-
22-08-2019 - |
Domanda
Che cosa è cambiato in IE8 che fa rilevare il supporto Selector InfoCard in javascript smettere di lavorare a meno che IE8 è messo in modalità di compatibilità?
E più precisamente, che cosa è il nuovo codice JavaScript per rilevare la presenza del supporto InfoCard?
Ecco lo script che ha funzionato attraverso IE7, tra cui Firefox con un plug-in, in alcuni casi:
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 >= 7) {
var embed = document.createElement("object");
embed.setAttribute("type", "application/x-informationcard");
return "" + embed.issuerPolicy != "undefined" && embed.isInstalled;
}
// 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.
if (document.addEventListener) {
var event = document.createEvent("Events");
event.initEvent("IdentitySelectorAvailable", true, true);
top.dispatchEvent(event);
if (top.IdentitySelectorAvailable == true) {
return true;
}
}
}
return false;
}
Soluzione
ho ottenuto una risposta fuori banda dal team IE8:
Cambia
embed.setAttribute("type", "application/x-informationcard");
a
embed.type = "application/x-informationcard";
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow