Vanilla JS: Totally disabling a “save” functionality in webpages

前端 未结 4 1641
Happy的楠姐
Happy的楠姐 2021-01-23 23:54

Assume I\'m a junior Wikipedia user that just want to experiment with changing some wikipedian content with the Wiki text editor in an edit-page, but not saving my changes in an

4条回答
  •  有刺的猬
    2021-01-24 00:10

    Onclick you could prevent the default action.

    document.addEventListener('keypress', function(e) {
        if (event.keyCode == 16 && event.keyCode == 18 && event.keyCode == 83) {
               e.preventDefault();
        }
    });
    

提交回复
热议问题