summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-08-13 19:55:29 -0400
committerJakob Kaivo <jkk@ung.org>2019-08-13 19:55:29 -0400
commitac5e89a94407187de715bfca7c1c8956ef0997f6 (patch)
tree2c0041bfe3cfcdd0e50ed29141a8d46e71f34cb3
parent1dc7d97614817f4c4f9f9aba43d2967aedec59d7 (diff)
prevent accidental navigation away
-rw-r--r--blog.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/blog.c b/blog.c
index 73c0ff1..2ecfa1f 100644
--- a/blog.c
+++ b/blog.c
@@ -151,6 +151,9 @@ int main(void)
puts("<script type=\"text/javascript\">");
puts("function update() {");
puts("\tdocument.getElementById(\"output\").innerHTML = document.getElementById(\"body\").value;");
+ puts("\twindow.onbeforeunload = function() {");
+ puts("\t\treturn 'Are you sure you want to leave?';");
+ puts("\t}");
puts("}");
puts("</script>");