Programming/javascript & HTML

웹에서 f5 갱신 막기

구차니 2019. 6. 4. 16:03

키코드로 막기

 

<script>

     window.onload = function () {
        document.onkeydown = function (e) {
            return (e.which || e.keyCode) != 116;
        };
    }

</script>

[링크 : https://www.aspsnippets.com/.../Disable-F5-Key-Button-and-browser-refresh-....aspx]

[링크 : https://www.c-sharpcorner.com/blogs/disable-f5-key-button-and-browser-refresh]

[링크 : https://zetawiki.com/wiki/웹브라우저_백스페이스,_F5_입력_막기]

 

1. window.onbeforeunload (calls on Browser/tab Close & Page Load)

2. window.onload (calls on Page Load)

[링크 : https://stackoverflow.com/questions/8013429/how-do-i-detect-a-page-refresh-using-jquery]