Get started with mobile-detect CDN
MIT licensed
Mobile-Detect is a lightweight PHP library for detecting mobile devices.
Tags:- useragent
- mobile
- phone
- tablet
- detect
- device
- browser
- version
- mobilegrade
- sniff
Stable version
Copied!
How to start using mobile-detect CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with mobile-detect CDN - cdnhub.io</title>
<script src="https://cdn.jsdelivr.net/npm/mobile-detect@1.4.5/mobile-detect.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const mobileDetect = new MobileDetect(window.navigator.userAgent);
const isMobile = mobileDetect.mobile();
const output = document.createElement('p');
output.textContent = `This device is: ${isMobile ? 'mobile' : 'desktop'}`;
document.body.appendChild(output);
});
</script>
</head>
<body>
</body>
</html>
Copied!
Copied!
Copied!
Copied!