다른 도메인간 iframe 소스에서 세로 크기가 늘어나기는 하는데 줄어 들지를 않습니다... 정보
다른 도메인간 iframe 소스에서 세로 크기가 늘어나기는 하는데 줄어 들지를 않습니다...본문
아래 소스대로 연결하기는 했는데 세로 길이가 늘어나기는 해도 줄어 들지를 않습니다...
값이 계속 남아 있나해서 초기화도 시켜 보고 했는데...
여전히 값이 늘어 나기만 합니다...
고수님들의 조언 부탁드립니다...
====================== auto_size.html - a.com =========================
<html>
<head>
<title>Resizing Page</title>
<script type="text/javascript">
function onLoad() {
var params = window.location.search.substring( 1 ).split( '&' );
var height;
for( var i = 0, l = params.length; i < l; ++i ) {
var parts = params[i].split( '=' );
switch( parts[0] ) {
case 'height':
height = parseInt( parts[1] );
break;
}
}
if( typeof( height ) == 'number' ) {
window.top.updateIFrame( height );
}
}
window.onload = onLoad;
</script>
</head>
<body>
<p>Resizing IFrame...</p>
</body>
</html>
=======================================================
그리고 a라는 홈페이지에서 링크할 문서에는 아래와 같이 삽입합니다.
======================= a.html - a.com ===================
<script type="text/javascript">
function updateIFrame( height ) {
var iframe = document.getElementById( 'myiframe' );
iframe.setAttribute( 'height', height );
}
</script>
http://b.com/b.html" scrolling=no frameborder=0 width="600" height="600">
이제 b라는 도메인의 b.html에는 아래와 같이 삽입합니다.
================== b.html - b.com============================
<style>
#inneriframe { position : absolute; top : 0px; left : 0px; visibility: hidden; }
</style>
<script type="text/javascript">
function rsize() {
var iframe = document.getElementById( 'inneriframe' );
var wrapper = document.getElementById( 'wrapper' );
var height = Math.max( document.body.offsetHeight, document.body.scrollHeight );
iframe.src = 'http://a.com/auto_size.html?height='+height; }
</script>
<body onload=rsize(); >
<div id=wrapper>
내용
</div>
<iframe id="inneriframe" width="10" height="10"></iframe>
</body>
값이 계속 남아 있나해서 초기화도 시켜 보고 했는데...
여전히 값이 늘어 나기만 합니다...
고수님들의 조언 부탁드립니다...
====================== auto_size.html - a.com =========================
<html>
<head>
<title>Resizing Page</title>
<script type="text/javascript">
function onLoad() {
var params = window.location.search.substring( 1 ).split( '&' );
var height;
for( var i = 0, l = params.length; i < l; ++i ) {
var parts = params[i].split( '=' );
switch( parts[0] ) {
case 'height':
height = parseInt( parts[1] );
break;
}
}
if( typeof( height ) == 'number' ) {
window.top.updateIFrame( height );
}
}
window.onload = onLoad;
</script>
</head>
<body>
<p>Resizing IFrame...</p>
</body>
</html>
=======================================================
그리고 a라는 홈페이지에서 링크할 문서에는 아래와 같이 삽입합니다.
======================= a.html - a.com ===================
<script type="text/javascript">
function updateIFrame( height ) {
var iframe = document.getElementById( 'myiframe' );
iframe.setAttribute( 'height', height );
}
</script>
http://b.com/b.html" scrolling=no frameborder=0 width="600" height="600">
이제 b라는 도메인의 b.html에는 아래와 같이 삽입합니다.
================== b.html - b.com============================
<style>
#inneriframe { position : absolute; top : 0px; left : 0px; visibility: hidden; }
</style>
<script type="text/javascript">
function rsize() {
var iframe = document.getElementById( 'inneriframe' );
var wrapper = document.getElementById( 'wrapper' );
var height = Math.max( document.body.offsetHeight, document.body.scrollHeight );
iframe.src = 'http://a.com/auto_size.html?height='+height; }
</script>
<body onload=rsize(); >
<div id=wrapper>
내용
</div>
<iframe id="inneriframe" width="10" height="10"></iframe>
</body>
댓글 전체
서버는 달라도 도메인이 같을경우만 될 듯 싶은데요.
document.domain = "";
document.domain = "";
유아원님 제가 이해가 잘 안돼서 그런데요 조금만더 자세히 써주시면 안될까요....?