If you want to just change the styling and layout of the page depending on the user's device, then you can use css's media queries[0]. But if you want to serve two totally different pages (one for mobile and another for desktop), then I don't see how it can be done without JS or reading the user agent.
[0] : https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queri...