JavaScript to detect whether page is load on Mobile or Desktop
<!DOCTYPE html>
<html>
<head>
<title>Mobile Test</title>
</head>
<body>
<p id="text"></p>
<script type="text/javascript">
var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
var element = document.getElementById('text');
if (isMobile) {
element.innerHTML = "You are using Mobile";
} else {
element.innerHTML = "You are using Desktop";
}
</script>
</body>
</html>