본문 바로가기

프레임셋 안에서 주소창 주소변경하기

이온디 2019.04.06 16:17 조회 1123 댓글 0
목록 글쓰기
<script>top.history.pushState(null, null, location.href);</script>

window.top. 혹은 top. 은 프레임 안에서일 경우입니다. 일반적인 경우는 

history.pushState()로 하시면 됩니다.


function changeUrl(title, url, state) {

    if (typeof (history.pushState) != "undefined") { //브라우저가 지원하는 경우
        history.pushState(state, title, url);
    }
    else {
        location.href = url; //브라우저가 지원하지 않는 경우 페이지 이동처리
    }
}


댓글 0

아직 댓글이 없어요

이 글에 대한 생각을 가장 먼저 남겨보세요.

댓글을 작성하려면 로그인이 필요합니다.