Click the verification code refresh achieve

Write code when run into a problem, it is to click on the image to refresh time will not re-request.

Because the method is to let img src request the server to return the captcha.

solve:

Add parameters in the request becomes an address of src, such as a random number, a time stamp may be, as long as the entire request is to change the path of the line.

principle:

img src request the address does not change, it will be considered the same picture, so I read from the cache, so I will not re-requested.

But in fact, I disable the cache in Firefox when, src request address without change parameters, but does not initiate the request.

This description is not read from the cache, I did not test other browsers too.

 

Anyway, it was behind the request address add a parameter changes can solve the problem.

Guess you like

Origin www.cnblogs.com/yellowgg/p/11297598.html
Recommended