How to prevent google chrome from caching my inputs, esp hidden ones when user click back?

后端 未结 2 364
渐次进展
渐次进展 2021-01-18 15:20

i have an asp.net mvc app which have quite a few hidden inputs to keep values around and formatting their names so that i can use the Model binding later when i submit the f

相关标签:
2条回答
  • 2021-01-18 15:24

    I guess you can reset the hidden fields as soon the page is loaded.

    <script type="text/javascript">
      $(function() {
          $("input[type=hidden]").val("");
      });
    </script>
    

    This code is executed when you hit "back".

    0 讨论(0)
  • 2021-01-18 15:42

    Moved here after reading @pruts comment ;)

    my boss found the answer, it was a simple autocomplete="off" added to the input attributes, although vwd will flag it as an error :)

    0 讨论(0)
提交回复
热议问题