Changing template from JS

I would like to change the template from shared.html to shared-mobile.html, to load only shared-mobile based on navigator.userAgent, all that from JS (I want to apply diff template and css when the website is accessed from mobile). If I can do that easily from PHP please share your ideas with me, as I see it now shared.html is hardcoded in Pathfinder.php : )
Thank you.

Hello,

I suggest to define your template based on the user agent in your application file:

function defaultTemplate(){ $mobile = false; // get the agent here if($mobile) { return array('layout-mobile'); } else { return array('layout'); } }

In my case it tries to load the file layout.html or layout-mobile.html in my templates folder. I am not sure if this is a pretty version, but it will do.

Sincerly, Phil