问题描述
< input id =q_1我的Rails应用程序中有一组单选按钮。 name =testtype =radiovalue =4>
< input checked =checkedid =q_2name =testtype =radiovalue =5>
< input id =q_3name =testtype =radiovalue =4>
这个功能就像点击一个未选中的单选按钮,点击单选按钮重定向到同一页面作为选中
。
单选按钮是基于 param $ c
问题:
- 选择一个新的单选按钮
- 点击浏览器后退按钮
- 数据将根据
param
值进行刷新,但单选按钮除外。单选按钮仍处于初始状态。
注意:此问题仅出现在 Chrome
。在 Firefox
和 IE
这个问题似乎是Chrome中的一个错误:
我可以通过在单选按钮中添加 autocomplete ='off'
来修复它。
< input autocomplete =offid =q_1name =testtype =radiovalue =4>
< input autocomplete =offchecked =checkedid =q_2name =testtype =radiovalue =5>
< input autocomplete =offid =q_3name =testtype =radiovalue =4>
I am having a set of radio button in a form in my Rails application.
<input id="q_1" name="test" type="radio" value="4">
<input checked="checked" id="q_2" name="test" type="radio" value="5">
<input id="q_3" name="test" type="radio" value="4">
The functionality is like on clicking an unchecked radio button it redirects to the same page with the radio button clicked as checked
.
The radio button is selected based on a param
value in the URL
Issue:
- Select a new radio button
- Click on browser back button
- Now all the a data gets refreshed based on the
param
value, except the radio button selection. The radio button is still in the initial state.
Note: The issue occurred only in Chrome
. It's working fine in Firefox
and IE
The issue seems to be a bug in Chrome:
https://code.google.com/p/chromium/issues/detail?id=244645
I was able to fix it by adding adding autocomplete='off'
to the radio buttons
<input autocomplete="off" id="q_1" name="test" type="radio" value="4">
<input autocomplete="off" checked="checked" id="q_2" name="test" type="radio" value="5">
<input autocomplete="off" id="q_3" name="test" type="radio" value="4">
这篇关于Chrome浏览器后退按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!