diff src/cjr_print.sml @ 1542:dc4c61363d0a

Add timestamps to 'app.js' filenames, to prevent inappropriate caching by browsers
author Adam Chlipala <adam@chlipala.net>
date Fri, 19 Aug 2011 08:59:01 -0400
parents e627bab3eda7
children 5f530f8e3511
line wrap: on
line diff
--- a/src/cjr_print.sml	Mon Aug 15 12:33:28 2011 -0400
+++ b/src/cjr_print.sml	Fri Aug 19 08:59:01 2011 -0400
@@ -2637,6 +2637,10 @@
                               newline]
             end
 
+        val timestamp = LargeInt.toString (Time.toMilliseconds (Time.now ()))
+        val app_js = OS.Path.joinDirFile {dir = Settings.getUrlPrefix (),
+                                          file = "app." ^ timestamp ^ ".js"}
+
         fun p_page (ek, s, n, ts, ran, side, tellSig) =
             let
                 val (ts, defInputs, inputsVar, fields) =
@@ -2756,8 +2760,7 @@
                                                 let
                                                     val scripts =
                                                         "<script type=\\\"text/javascript\\\" src=\\\""
-                                                        ^ OS.Path.joinDirFile {dir = Settings.getUrlPrefix (),
-                                                                               file = "app.js"}
+                                                        ^ app_js
                                                         ^ "\\\"></script>\\n"
                                                 in
                                                     foldl (fn (x, scripts) =>
@@ -3117,8 +3120,7 @@
              string "static void uw_handle(uw_context ctx, char *request) {",
              newline,
              string "if (!strcmp(request, \"",
-             string (OS.Path.joinDirFile {dir = Settings.getUrlPrefix (),
-                                          file = "app.js"}),
+             string app_js,
              string "\")) {",
              newline,
              box [string "uw_Basis_string ims = uw_Basis_requestHeader(ctx, \"If-modified-since\");",