Safari and Chrome back button changes hidden and submit values in forms

后端 未结 4 2147
Happy的楠姐
Happy的楠姐 2020-12-09 13:13

The following problem happens on both Safari and Chrome, so probably a WebKit issue.

Page A: a page that requires you to login to see, contains a form that has a typ

4条回答
  •  一个人的身影
    2020-12-09 14:04

    One solution to this is to have it reset the form when the document is loaded

    function ready(fn) {
      if (document.readyState != 'loading'){
        fn();
      } else {
        document.addEventListener('DOMContentLoaded', fn);
      }
    }
    
    function resetForm() {
       document.forms["myForm"].reset()
    }
    ready(resetForm)
    
    

提交回复
热议问题