
How to Detect Online and Offline Status
Detect online and offline status with navigator.onLine and the online and offline events, understand their limits, probe with fetch and queue requests safely.
Tag
7 posts

Detect online and offline status with navigator.onLine and the online and offline events, understand their limits, probe with fetch and queue requests safely.

Make keyboard shortcuts in JavaScript with keydown, event.key and modifiers, a registry, input field guards, cross-platform keys, chords and accessibility.

When the JavaScript toggle event fires for details, popovers and dialogs, how beforetoggle and newState work, and how to lazy-load content with it.

When the JavaScript keydown event fires, how key, code and repeat differ, modifier keys, shortcuts, IME composition and accessible keyboard handling.

Handle paste events in JavaScript with clipboardData: read text, HTML and files, strip formatting, paste images, sanitize input and keep undo working.

When the JavaScript transitionend event fires, why it fires once per property and bubbles, how to avoid missed events, and when to use animation promises.

Add and remove event listeners properly in JavaScript: matching references, the once and signal options, capture, passive, delegation and avoiding memory leaks.