//1. split() method를 사용한 location 방법
window.location = window.location.href.split("?")[0];
//2. pathname 을사용한 location 방법
window.location = window.location.pathname;
위의 코드는 같은 동작을 하며, GET 파마리터 를 제거한 현재의 URL주소로 페이지를 새로고침하게된다.
//(event.keyCode == 78 || event.keyCode == 82) : ctrl+N , ctrl+R
//(event.keyCode == 116) : f5
//F5, 새로고침 , Ctrl + R, Ctrl + N ==> 키보드 이벤트 적용
if((event.ctrlKey == true && (event.keyCode == 78 || event.keyCode == 82)) || (event.keyCode == 116))
{
myscript();
}
이런식으로 버튼식 초기화로 구현하던가, 새로고침 버튼 key값을 이용하여 새로고침시 자동으로 적용되도록 하면 될것같다.
'JAVASCRIPT' 카테고리의 다른 글
선택한 요소 addClass, removeClass, toggleClass (0) | 2022.03.04 |
---|---|
체크박스 선택시 배열 추가 push (0) | 2022.03.03 |
새로고침 방지하기 (0) | 2022.02.23 |
input type='file' multiple 업로드 미리보기 (0) | 2022.02.02 |
class와 object (0) | 2022.01.30 |