0
내 기능은 다음과 같습니다. 그리고 onload
이벤트 핸들러에서 scrollHeight
을 iframe
으로 계산하려고합니다. 하지만 오류 메시지 만 표시됩니다. 어떤 사람이 도와 주실 수 있습니까? 그것은 같은 도메인 (동일한 포트와 프로토콜 사용) 상위 페이지 등을에있는 경우실제 iframe 높이를 계산하는 중 오류가 발생했습니다.
function showHBewertung(W3CElement, objCode) {
var iframe = document.createElement("iframe");
iframe.className = "bewertung_iframe"
iframe.src = "http://example.com?giatacode="+objCode;
W3CElement.appendChild(iframe);
iframe.onload = function() {
var height=iframe.contentWindow.document.body.scrollHeight;
iframe.style.cssText = "width:100%;height:" + height + "px";
}
}
오류 메시지가 구체적으로 무엇을 말합니까 : 당신이 할 경우, 당신은
scrollHeight
iframe.contentDocument.body.scrollHeight
와 iframe이 문서의 액세스 할 수 있습니까? – reporter방화범 표시는 무엇입니까? – Rahul
오류 : 'document'에 대한 액세스 권한이 거부되었습니다. – user160820