2014-10-12 3 views
0

PHP에 관한 질문과 페이지 리디렉션에 관한 질문이 있습니다. 내 HTML에는 iframe이 있습니다.PHP에서 _top 리다이렉트 사용하기

<iframe class="container" name="content" id="content" src="LandingPage.php" name="contents" scrolling="no" frameborder="0" onload="sizeFrame(this)" ></iframe><!-- CONTENT frame --> 

iframe에 index.php 만 표시하는 것이 아니라 전체 문서를 index.php로 다시로드하려고합니다. 현재 내 모든 노력과 검색 제안은 iframe에서 index.php 파일을로드합니다. 어떻게하면 현재 loggedin.html 파일을 언로드하고 같은 창에서 index.php 만 다시로드하도록 페이지를 강제 할 수 있습니까?

LandingPage.php 상단에서 다음을 테스트하여 페이지를 표시 할 수 있는지 확인했습니다.

index.php 파일이 올바른 위치에 표시되지 않으므로 잘못된 세션이 아닙니다.

 if(! isset($_SESSION['loginvalid'])) 
{ 
    //header("Location: index.php"); 
    //exit(); 
    $URL="index.php"; 
    $t = "_top"; 
    echo "<script>window.location.replace='$URL' target= '$t'</script>"; 
    //echo"window.location.href = $URL target= \"_top\""; 
    exit; 

    } else { 

모든 도움과 제안을 부탁드립니다.

+0

'은 iframe에서 window'는, 상위 페이지 창이 아닌가 Iframe 내 유일한 창이다 https://developer.mozilla.org/ 시도 ko-ko/docs/Web/API/Window.parent – charlietfl

+0

무슨 뜻인지 알 겠어. 스크립트가 잘못된 요소를 참조하고 있습니다. 감사! – Acidface21

답변

1

대신

<script>window.location.replace='$URL' target= '$t'</script> 

<script>parent.location='$URL'</script> 
+0

확인. 정말 고맙습니다! 이것은 문제를 해결했습니다! 도움이 정말로 감사합니다. – Acidface21