diff options
author | Adam Chlipala <adam@chlipala.net> | 2011-08-19 08:59:01 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2011-08-19 08:59:01 -0400 |
commit | afaf7f27220ccc94b3bb29fb14994040e97b1f4e (patch) | |
tree | 590cf1011292fdf19844803e40b034f3970d5161 /src/cjr_print.sml | |
parent | 5f56fea79779cbb0f77ae0058cfa7bbe60bb914f (diff) |
Add timestamps to 'app.js' filenames, to prevent inappropriate caching by browsers
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r-- | src/cjr_print.sml | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml index cfe8ee13..159948b3 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -2637,6 +2637,10 @@ fun p_file env (ds, ps) = 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 @@ fun p_file env (ds, ps) = 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 @@ fun p_file env (ds, ps) = 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\");", |