Skip to content

isOnline

The isOnline function checks if the browser is currently connected to the internet.

Syntax

typescript
isOnline(): boolean;

Parameters

NameTypeDescription
This function does not take any parameters

Returns

NameTypeDescription
booleantrue if online

Examples

typescript
isOnline();
// => true

Notes

  • Useful for adapting features based on connectivity.

References

Released under the MIT License.