html刷新界面或者按F5表单重复提交很笨的解决办法

页面表单数据重复提交,看着很烦人,之前搜索资料看的稀里糊涂,不过最后找到了一个笨方法,就是通过js写一个禁用F5的功能,下面就是这行代码

<script type="text/javascript">
            if ( window.history.replaceState ) {
                window.history.replaceState( null, null, window.location.href );
            }
</script>

放在</body>标签上方即可,之后按F5和刷新界面,就不会重复提交表单了

原文地址:https://www.cnblogs.com/ShineLeem/p/11325617.html