「iframe.contentDocument」はIE8およびFF(3.5以下)で機能していません。これを解決するための他の手順はありますか?
-
29-09-2019 - |
質問
JS File-Uploaderでこの「iframe.contentDocument」を使用しましたが、IE8、Firefox(3.5以下のバージョン以下で動作しません。IFRAMEを使用するために他のDOMを使用してこれを解決するにはどうすればよいですか?
ありがとうございます
解決
試す
var doc;
var iframeObject = document.getElementById('iframeID'); // MUST have an ID
if (iframeObject.contentDocument) { // DOM
doc = iframeObject.contentDocument;
}
else if (iframeObject.contentWindow) { // IE win
doc = iframeObject.contentWindow.document;
}
if (doc) {
var something = doc.getElementById('someId');
}
else {
alert('Wonder what browser this is...'+navigator.userAgent);
}
所属していません StackOverflow