页面/浏览器关闭/退出时自动保存/提交表单 [英] auto save/submit form on page/browser close/exit

查看:564
本文介绍了页面/浏览器关闭/退出时自动保存/提交表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有保存按钮的表单,但我希望用户能够随时返回到表单以完成填写。我想知道是否可以绕过保存按钮,因此用户填写表格的一部分,一旦他们离开页面或关闭他们的浏览器,它将自动保存表格,以便下次恢复。

I have a form with a save button, but i want users to be able to come back to the form at anytime to finish filling it in. I would like to know if its possible to bypass the save button, so the user fills part of the form in, as soon as they navigate away from the page or close their browser it will save the form automatically to resume next time.

什么是实现这个的最佳方法?非常感谢您提供任何帮助,非常感谢。

What would be the best way to implement this? Thanks in advance for any help, its much appreciated.

我看过一些javascript示例,但看到了跨浏览器支持的问题。

I have seen some javascript examples but have seen issues with cross browser support.

推荐答案

Jquery插件,用于自动保存功能。
http://plugins.jquery.com/project/jquery-autosave

Jquery plugin, works a treat for autosave function. http://plugins.jquery.com/project/jquery-autosave

更多信息:
http ://rikrikrik.com/jquery/autosave/#examples

包含插件:

<script type="text/javascript" src="scripts/jquery.autosave.js"></script>
    $('form.formnamehere').autosave({
      'interval': 20000
    });

自动提交表格而不刷新页面。

Auto submits form without page refresh.

我已将间隔设置为1秒(1000),因此表格每秒都会保存。因此,如果用户在编辑后退出表单,则表示已自动保存。

I have set my interval to one second (1000) so the form gets saved every second. Therefor if the user exits the form after editing then it has autosaved.

这篇关于页面/浏览器关闭/退出时自动保存/提交表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆