Captcha image display problem in FireFox

Discussion in 'PHP' started by slimbachiya, May 31, 2008.

  1. #1
    Hello everyone.

    I am currently working on captcha to validate a form to register. I am developing the website using PHP - SMARTY - AJAX (XAJAX).

    With AJAX I am re-displaying image every time user clicks on "Try different words". This works fine in IE.

    The problem is with FireFox. It do not shows new captcha image. The problem I found is FF caches the images. If I clear the cache and click the link It shows the new image, but for next I need to clear cache again. I am replacing entire <img src...> tag each time user click.

    Please suggest possible solution.
    Thanks & Regards,
     
    slimbachiya, May 31, 2008 IP
  2. goldensea80

    goldensea80 Well-Known Member

    Messages:
    422
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    128
    #2
    THat's right,
    But you can use this trick, when you reload captcha using javascript (right?) append a random dummy number as a query to the captcha image src, e.g <img src="capcha.php?time=123121" ... that will force FF to reload the captcha. You can see it in my website (on the comment story, for example)
     
    goldensea80, May 31, 2008 IP
  3. slimbachiya

    slimbachiya Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi Goldensea80,
    Thanks for helping me. By appending a dummy random number, My problem solved. Now I can see the changing captcha image on FireFox too.

    Thank you very much.
     
    slimbachiya, Jun 2, 2008 IP
  4. Aequitas

    Aequitas Guest

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yeah FireFox is awesome and there cache is top notch but sometimes they do things a little bit too well, in cases like this when your trying to test I've lost a few hours before because of the cache problems but using a new dummy Paramater on the URL forces it to re-cache the page.
     
    Aequitas, Jun 2, 2008 IP