gpt4 book ai didi

javascript - 如何停用(删除)未提交表单上的 "confirm you want to leave this page"?

转载 作者:行者123 更新时间:2023-11-30 12:48:53 27 4
gpt4 key购买 nike

我的页面上有一个 AJAX 自动保存输入字段,非常棒!问题是在 Safari 中,当用户离开页面时,他会收到警告

  • “您确定不提交表格就离开吗?”

这显然我不想要

我怎样才能摆脱它!?!

enter image description here

所以这样的帖子的对面:Dont ask confirm if user submit the form

最佳答案

当该消息弹出时,将触发此事件:onbeforeunload。只需将此添加到您的 javascript 代码中即可删除此事件:

window.onbeforeunload = null;

关于javascript - 如何停用(删除)未提交表单上的 "confirm you want to leave this page"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21652583/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com