会发生什么事时,关闭浏览器窗口,形成/ JavaScript的数据? [英] What happens to form / JavaScript data when browser window is closed?

查看:108
本文介绍了会发生什么事时,关闭浏览器窗口,形成/ JavaScript的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在输入元素收集数据的HTML表单,然后生成(使用jsPDF)用户下载(使用Downloadify JS)的PDF文件。收集的数据包含个人信息。

I have a html form which collects data in input elements and then generates a PDF (using jsPDF) for the user to download (using Downloadify js). The data collected contains personal information.

我需要知道的是将输入到输入元素,然后把它由JavaScript处理的数据,保留在浏览器内存中,当用户浏览其他地方或关闭浏览器窗口?

What I need to know is will the data entered into the input elements, which then gets processed by JavaScript, remain in browser memory when the user navigates elsewhere or closes the browser window?

推荐答案

是的,它可能会保留在内存中一段时间​​。这超出你的控制,并将浏览器和操作系统之间的差异。

Yes it will probably remain in memory for a period. This is beyond you control, and will differ between browsers and operating systems.

如果您的形式是不实际提交到服务器,自动完成不应该存储它,尽管你可能要添加自动完成=关闭要格外肯定这一点

If your form is not actually submitted to the server, autocomplete should not store it, although you may want to add autocomplete="off" to be extra sure of this.

您也可以使用JavaScript,一旦处理完成表单值设置为空。

You could also use JavaScript to set the form values to blank once processing is done.

document.getElementById('name').value = '';

您也可以将任何JavaScript使用后,反对无效。这将不能保证数据不会在内存的某个地方举行。你可以鼓励用户关闭所有浏览器窗口操作系统的使用和注销后,如果这是一个问题。浏览器,如Chrome浏览器可以保留在内存中,即使所有的窗口都关闭,因为它可以住在系统托盘中如果该选项被设置成注销将强制关闭,同时易于为用户做的。

You could also set any JavaScript objects to null after use. This will not guarantee that the data would not be held in memory somewhere. You could encourage users to close all browser windows after use and logout of the operating system if this is a concern. Browsers such as Chrome can remain in memory even though all windows are closed as it can live in the system tray if that option is set so logging out will force it to close whilst being easy for users to do.

这篇关于会发生什么事时,关闭浏览器窗口,形成/ JavaScript的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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