detectDeviceType() this function will return you a string value either "Mobile" or "Desktop".
See Demo on Codepen :-
Our one and only aim is to reveal all the useful things on Internet in Front of People . #BeCreative
const detectDeviceType = () =>
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
? 'Mobile'
: 'Desktop';
// Example
detectDeviceType(); // "Mobile" or "Desktop"
Comments
Post a Comment