간단한 페이지 리디렉션은 아래처럼 하시면 되요~
<head> <script type="text/javascript"> <!-- window.location="http://www.newlocation.com"; //--> </script> </head> |
<head> <script type="text/javascript"> <!-- function Redirect() { window.location="http://www.newlocation.com"; } document.write("You will be redirected to main page in 10 sec."); setTimeout('Redirect()', 10000); //--> </script> </head> |
여기서 사용된 setTimeout() 메소드는 JavaScript에서 기본으로 제공하는 메소드로 특정 시간 후에 다른 함수를 호출할 수 있게끔 해줍니다.
<head> <script type="text/javascript"> <!-- var browsername=navigator.appName; if( browsername == "Netscape" ) { window.location="http://www.location.com/ns.htm"; } else if ( browsername =="Microsoft Internet Explorer") { window.location="http://www.location.com/ie.htm"; } else { window.location="http://www.location.com/other.htm"; } //--> </script> </head> |
Reference : http://www.tutorialspoint.com/javascript/javascript_page_redirect.htm
[Javascript / 자바스크립트] 강좌 #15 - void 키워드 (0) | 2015.08.05 |
---|---|
[Javascript / 자바스크립트] 강좌 #14 - Dialog Boxes ( 다이얼로그 박스 ) (0) | 2015.08.05 |
[Javascript / 자바스크립트] 강좌 #12 - Cookie handling ( 쿠키 핸들링 ) (0) | 2015.08.05 |
[Javascript / 자바스크립트] 강좌 #11 - Event Handling ( 이벤트 처리 ) (0) | 2015.08.05 |
[Javascript / 자바스크립트] 강좌 #10 - Functions ( 함수 ) (0) | 2015.08.05 |