가벼운 배움/javascript
부모 iframe의 url을 확인하여 리다이렉트시키기
호홍홍집
2016. 10. 25. 09:11
***************** xyz.hohong.kr/animation/index.jsp 파일(iframe 이용페이지)
<head>
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding:0;
border:0;
overflow:hidden;
}
</style>
</head>
<body scrolling="no">
<iframe src="http://abc.hong.kr/index.jsp" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>
</body>
</html>
********* abc.hong.kr/index.html 에
<head>
<script type="text/javascript">
if(parent && parent != this){
location.href='index.jsp';
}else{
location.href='http://xyz.hohong.kr/animation/';
}
</script>
</head>
<body>
</body>
</html>
index 파일의 우선권을 이용한 iframe 이용 sub디렉토리 도메인 연결...^^