Jungsoomin :)
2020. 8. 23. 18:58
사용자가 클릭을 통해 페이지가 이동하면 location.href=""을 사용,
HTTP Redirect를 하고 싶으면 location.replace("")를 사용.
즉 location 객체의 replace 함수는 history stack에 남지 못한다는 이야기를 뜻하는 것 같다.
//HTTP Redirect를 클라이언트에서 처리
window.location.replace("http://soomin.com");
//사용자의 클릭 이벤트용
window.location.href = "http://soomin.com";
//assign 복사함수로도 구현 가능
window.location.assign('http://soomin.com');
//window뿐 아니라 document로도 가능
document.location.href = '/path';
//구형 익스플로어에서는 다음방법도 가능했다.
window.navigate('http://soomin.com');
//히스토리를 이용하여 이동하는 방법
window.history.back();
window.history.go(-1);
//
self.location = 'http://soomin.com';
밑에는 개인적으로 생각해본 ...쓰임새 이다.
<script>
setTimout(function(){
window.location.href='http://soomin.com'
}, mils);
//대기 후 화면 호출
var condition = true; // 개발자 조건
if(condition){
window.location.href='http://soomin.com';
}
//조건에 따른 호출
$('객체').on('이벤트이름',function(){
window.location.href='http://soomin.com'
});
// 이벤트 작동시 호출