Normal solutions for Google and other browsers without refreshing the verification code in IE _ javascript skills

Source: Internet
Author: User
In IE, the verification code will not be refreshed, but there is no problem with Google and other browsers. The solution is to add a random parameter after the switching address of the Verification Code. Today, we found it in IE when doing the verification code, the verification code will not be refreshed, but Google and other browsers will be fine, so I think it should be a cache problem, because the default setting of IE is that if the access address does not change, it will not be obtained but will load the content in the cache.

Therefore, the solution is to add a random parameter to the switch address of the verification code.

For example:

The Code is as follows:


Script
// Change the verification code
Function changeimg (){
/*
Math. the random range is 0-1.
* 999 to 0-999
+ 3000 is 3000-3999
*/
Var time = Math. round (Math. random () * 999) + 3000;
$ ('# Captcha'). attr ('src', '/index. php/Public/verify/time/' + time );
}
Script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.