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

前端 未结 4 1643
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:09

    If you can to know which method is called after clicking the save button, the way below can be helpful:

    My suggested way is pressing f12 and then clicking on the save button to find the save method. Now, after finishing dom loading (in your code), you must replace gained function with an empty function like this:

    FOUNDEDSaveFunc = function(){};
    

    If clicking on the save button leads to refresh, you can gain that called action with some apps like fiddler (instead of pressing f12).


    Also, document.addEventListener adds new listener to current existing listeneres. Because this, the main function that handles keypress, and your added function, will run both (the original save function still will call in this case).

提交回复
热议问题