[interchange] IC cache busting for captcha refresh.

Mark Johnson interchange-cvs at icdevgroup.org
Tue Dec 11 01:51:10 UTC 2012


commit 4d5a1b20270d38f2d1883ef8461428c30ad43a77
Author: Mark Johnson <mark at endpoint.com>
Date:   Mon Dec 10 20:50:36 2012 -0500

    IC cache busting for captcha refresh.

 eg/captcha_refresh.cfg |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/eg/captcha_refresh.cfg b/eg/captcha_refresh.cfg
index f3cb318..06051fb 100644
--- a/eg/captcha_refresh.cfg
+++ b/eg/captcha_refresh.cfg
@@ -44,6 +44,8 @@ sub {
         <script>
         function $js_func_name() {
             var ajax = new XMLHttpRequest();
+            // Extra cache-busting insurance if header doesn't work
+            var cb = new Date().getTime();
 
             ajax.onreadystatechange = function() {
                 if (ajax.readyState == 4 && ajax.status == 200) {
@@ -51,7 +53,7 @@ sub {
                 }
             }
 
-            ajax.open('GET','$url',true);
+            ajax.open('GET','$url?cb='+cb,true);
             ajax.send();
             return;
         }
@@ -73,6 +75,10 @@ sub {
     $opt{name_only} = 1;
 
     my $doc = Vend::Document->new;
+
+    # Bust that cache for IE
+    $doc->header('Cache-Control: no-cache');
+
     $doc->hot(1);
     $doc->write($::Tag->captcha(\%opt));
     return 0;



More information about the interchange-cvs mailing list