Skip to content

Commit 8981be0

Browse files
docs: update doc about the closeOnBeforeunload option
Related: socketio/socket.io#4770
1 parent f7dac53 commit 8981be0

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

docs/client-options.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,19 @@ Default value: `false`
118118

119119
Whether to (silently) close the connection when the [`beforeunload`](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event) event is emitted in the browser.
120120

121-
When this option is set to `false` (the default value), the Socket instance will emit a `disconnect` event when the user reloads the page **on Firefox**.
121+
When this option is set to `false` (the default value), the Socket instance will emit a `disconnect` event when the user reloads the page **on Firefox**:
122+
123+
![Example with Firefox when closeOnBeforeunload is set to false](/images/closeonbeforeunload-false.gif)
122124

123125
:::note
124126

125127
This behavior is specific to Firefox, on other browsers the Socket instance will not emit any `disconnect` event when the user reloads the page.
126128

127129
:::
128130

129-
When this option is set to `true`, all browsers will have the same behavior (no `disconnect` event when reloading the page).
131+
When this option is set to `true`, all browsers will have the same behavior (no `disconnect` event when reloading the page):
132+
133+
![Example with Firefox when closeOnBeforeunload is set to true](/images/closeonbeforeunload-true.gif)
130134

131135
:::caution
132136

64.5 KB
Loading
60.8 KB
Loading

0 commit comments

Comments
 (0)