开发者

" iframe.contentDocument" Not Working in IE8 and FF(3.5 and below) any other steps to solve this?

开发者 https://www.devze.com 2023-01-28 02:10 出处:网络
I used this \"iframe.contentDocument\" in js file-uploader , But it not working in IE开发者_如何学JAVA8 ,Firefox(3.5 and below versions.

I used this "iframe.contentDocument" in js file-uploader , But it not working in IE开发者_如何学JAVA8 ,Firefox(3.5 and below versions. How can i solve this by using other DOM's for working with iframe ?

Thanks to all


Try

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);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号