クローンされたコンテンツを新しいウィンドウに追加しようとすると、Microsoft Edgeで「このようなインターフェイスはサポートされていません」というエラーがスローされます。次に例を示します。jQuery append()をMicrosoft Edgeで動作しない新しいウィンドウに追加する
jQuery(document).ready(function() {
jQuery('.trigger').click(function() {
var target = jQuery(this).data('print_target');
var w = window.open('', '', 'status=no, toolbar=no, menubar=no, location=no');
var print_html = '<!DOCTYPE html><head><title>' + document.getElementsByTagName('title')[0].innerHTML + '</title></head><body></body></html>';
w.document.write(print_html);
var ua = window.navigator.userAgent;
var ie = true;
//.html() required for IE browsers
if (ua.indexOf("MSIE ") != -1) {
//console.log('MSIE - Craptastic');
jQuery(w.document.body).append(jQuery(target).clone(true).html());
}
else if (ua.indexOf("Trident/") != -1) {
//console.log('IE 11 - Trident');
jQuery(w.document.body).append(jQuery(target).clone(true).html());
}
else if (ua.indexOf("Edge/") != -1){
console.log('IE 12 - Edge');
//error: No such interface supported
jQuery(w.document.body).append(jQuery(target).clone(true).html());
//works
//jQuery(w.document.body).append('hey dude, this is some text');
//works
//jQuery(w.document.body).html(jQuery(target).clone(true).html());
}
else{
//console.log('proper browser');
jQuery(w.document.body).append(jQuery(target).clone(true));
ie = false;
}
});
});
これは、Microsoftのエッジを持つ唯一の問題である、それは同様の問題がraised in this threadをされてますがされていない7,8,9,10および11ベースのブラウザとIEのブラウザは解決すべての規格で動作します。 https://jsfiddle.net/switzerbaden/nhtywLsp/