0

I'm facing a major problem. When I'm changing the image of my captcha on clicking the link "Not readable? Change text." then in this case only IE8 not changing the image while other browser supports it. If any one knows its reason then plz let me know. My coding is below. Thanks

<div id="captcha1">
    <img src="captcha.php" id="captcha" />
        <br/>
            <a href="#" onclick="
    document.getElementById('captcha').src='captcha.php?'+Math.random();
    document.getElementById('captcha-form').focus();"
    id="change-image">Not readable? Change text.</a>
</div>

2 Answers2

1

Ok, change your Cache-Control header by the following :

header('Cache-Control: no-cache, no-store, must-revalidate, post-check=0, pre-check=0');

post-check and pre-check are specific to IE from what I've read.

See more doc. on this topic here :

http://php.net/manual/en/function.session-cache-limiter.php

And about the way it works :

enter image description here

How about an example? Suppose an HTTP server sends an image with the following header: Cache-Control: post-check=3600,pre-check=43200 Both pre-check and post-check specify time intervals in seconds. We tell IE to cache the mentioned image for 12 hours (60 * 60 * 12 seconds). The first hour (60 * 60 seconds) IE will simply display the image from its local cache. However, after 60 minutes we want it to check for a newer one in the background, i.e. it will display the cached one and then do a background check. When 12 hours are up, IE checks for a modified image first.

SOURCE

Note : clear your cache from the browser before testing ;).

Melvin
  • 226
  • 1
  • 6
0

I would suspect an IE8 caching problem; that is your Math.random() not working properly. Have a look there : IE8 is still caching my requests even with mathrandom

Community
  • 1
  • 1
Melvin
  • 226
  • 1
  • 6