HTML DOM
GitHub 0★
Check if the code is running in the browser
We can detect if the current code is running in the browser by checking the existence of
window
and
document
objects:
const
isBrowser
=
typeof
window
===
'object'
&&
typeof
document
===
'object'
;
See also
Detect internet explorer browser
Detect mac os browser
Detect mobile browsers
Check if an element is visible in a scrollable container
Check if the native date input is supported