JMPTech
 
Mobile device alternate homepage

Overview

The code
checkWidth.js
function checkWidth() {
    if (window.innerWidth < 768) { // 768px works for mobile
        window.location.href = "mobile.php";  // The alternate page
    }
}
// Run on page load
window.onload = checkWidth;
// Run on window resize
//window.onresize = checkWidth;

Note that the window.onresize = checkWidth; is commented out; It can cause race conditions,
so I don't use it.

To use

Place this in the <head> section of your web page.

Include
<script src="assets/checkWidth.js"></script>

Note: I found this script online, and couldn't determine the proper attribution. It is such a simple script that I doubt that it can be legitimately claimed by anyone, but if anyone knows the correct credit info please notify me.
JMP - Mon Apr 27 email