Skip to content

Commit e996549

Browse files
Warn on closing tab to prevent unintentional loss of progress (#248)
1 parent 032f83d commit e996549

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

_layouts/post.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ <h1 class="post-title" itemprop="name headline">{{ page.title }}</h1>
7878
});
7979
window.onbeforeunload = function(e) {
8080
navigator.sendBeacon("{{site.pwdurl}}/sessions/" + pwd.sessionId + "/close");
81-
return;
81+
e.preventDefault();
82+
e.returnValue = 'Hi';
8283
}
8384

8485
</script>

0 commit comments

Comments
 (0)