简体   繁体   English

切换页面时保留表单数据

[英]Preserve form data when switching pages

  <form> <input type="text" name="foo"> </form> <a href="b.html"> b.html </a> 

This piece of code is on a.html . 这段代码在a.html If someone enters some value hello world into the text box and clicks on the link to go to b.html , and then he goes back to a.html by hitting back button. 如果某人在文本框中输入了一些“ hello world ”,然后单击链接转到b.html ,然后他通过单击“后退”按钮返回到a.html Will the form state (text box hello world ) be preserved? 表单状态(文本框hello world )是否会保留?

I have tested it in Chrome and it is fine the value will be populated back. 我已经在Chrome中对其进行了测试,可以将值填充回去。

I just wanted to know how this behaviour is going to happen in other major browsers? 我只是想知道在其他主要浏览器中这种情况将如何发生? support mobile browser? 支持手机浏览器?

This behavior is built into all major browsers (Chrome, Safari, Firefox, latest versions of IE) and at least Chrome for Android. 所有主要浏览器(Chrome,Safari,Firefox,IE的最新版本)以及至少适用于Android的Chrome都内置了此行为。 I'm pretty sure it works for iOS as well (not sure for all mobile browsers, there are a lot of different phones/versions these days). 我很确定它也适用于iOS(不确定是否适用于所有移动浏览器,如今有很多不同的手机/版本)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM