Home > Web Front-end > JS Tutorial > Solution to the problem that the verification code does not refresh in IE but works normally in Google and other browsers_javascript skills

Solution to the problem that the verification code does not refresh in IE but works normally in Google and other browsers_javascript skills

WBOY
Release: 2016-05-16 16:55:04
Original
1059 people have browsed it

When I was doing the verification code today, I found that in IE, the verification code would not refresh, but other browsers such as Google had no problem, so I thought it might be a cache problem, because the default setting of IE is that if the access address does not change, it will not go there. Get but load the content in the cache

So the solution is to add a random parameter after the switching address of the verification code

For example:

Copy code The code is as follows:

<script> <br>//Change verification code<br>function changeimg(){ <br>/ * <br>math.random range is 0-1 <br>*999 becomes 0-999 <br> 3000 is 3000-3999 <br>*/ <br>var time=Math.round(Math.random() *999) 3000; <br>$('#captcha').attr('src','__APP__/Public/verify/time/' time); <br>} <br></script>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template