Chrome浏览器后退按钮问题

Chrome浏览器后退按钮问题

本文介绍了Chrome浏览器后退按钮问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < 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 URL



问题


  1. 选择一个新的单选按钮
  2. 点击浏览器后退按钮

  3. 数据将根据 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:

  1. Select a new radio button
  2. Click on browser back button
  3. 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浏览器后退按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 09:45