diff options
author | 2011-01-06 14:25:42 -0500 | |
---|---|---|
committer | 2011-01-06 14:25:42 -0500 | |
commit | d854f728c124bc985c4654ac39fbb84da644ad6c (patch) | |
tree | fa620106b21cda5516c17d6ab697326b9066c5fd | |
parent | a4befc4babeacecd8dc724a4ba4b97ef5a7e3151 (diff) |
Client-side redirects
-rw-r--r-- | lib/js/urweb.js | 4 | ||||
-rw-r--r-- | src/jscomp.sml | 12 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index bba58453..3cb667d6 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -715,6 +715,10 @@ function unurlify(parse, s) { return parse(s); } +function redirect(s) { + window.location = s; +} + function rc(prefix, uri, parse, k, needsSig) { uri = cat(prefix, uri); uri = flattenLocal(uri); diff --git a/src/jscomp.sml b/src/jscomp.sml index 3b859814..dbbb83b2 100644 --- a/src/jscomp.sml +++ b/src/jscomp.sml @@ -875,7 +875,17 @@ fun process file = | ENextval _ => unsupported "Nextval" | ESetval _ => unsupported "Nextval" | EReturnBlob _ => unsupported "EReturnBlob" - | ERedirect _ => unsupported "ERedirect" + + | ERedirect (e, _) => + let + val (e, st) = jsE inner (e, st) + in + (strcat [str "{c:\"f\",f:\"redirect\",a:cons(", + e, + str ",null)}"], + st) + end + | EUnurlify (_, _, true) => unsupported "EUnurlify" | EUnurlify (e, t, false) => |