heavyEddie Posted June 3, 2007 Share Posted June 3, 2007 I'm trying to force my captch to reload the image when a user clicks the image. However, if you don't provide a unique URL some browsers will use a cached version of the image and not reload. So, this is the code I'm trying to use, but it seems I'm doing something wrong. Comes back with "now is not defined". I'm pretty sure this is javascript 101 echo '<img src="captcha.php?id=' . $id . '" onclick="javascript: this.src=\'captcha.php?id=' . $id . '&time=\' + now.getTime();" />'; Link to comment https://forums.phpfreaks.com/topic/54070-how-to-force-a-browser-to-reload-captcha-image/ Share on other sites More sharing options...
heavyEddie Posted June 3, 2007 Author Share Posted June 3, 2007 Never mind, this seems to work well... echo '<img src="captcha.php?id=' . $id . '" onclick="javascript: this.src=\'captcha.php?id=' . $id . '&time=\' + (new Date()).getTime();" />'; Link to comment https://forums.phpfreaks.com/topic/54070-how-to-force-a-browser-to-reload-captcha-image/#findComment-267283 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.