summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/c/urweb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 476fb09b..9915219d 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -692,6 +692,8 @@ void uw_write_script(uw_context ctx, uw_Basis_string s) {
const char *uw_Basis_get_script(uw_context ctx, uw_unit u) {
if (ctx->script_header[0] == 0)
return "";
+ else if (buf_used(&ctx->script) == 0)
+ return ctx->script_header;
else {
char *r = uw_malloc(ctx, strlen(ctx->script_header) + 42 + buf_used(&ctx->script));
sprintf(r, "%s<script type=\"text/javascript\">%s</script>",