I've built a cool mobile website/app using JQuery Mobile. I want to offer that to clients, but I want to use my own hosting.
Here's what I want to do
If a user uses a mobile device to visit client.com
, I want them to see the contents of mysite.com/mobile/?app=1
.
If a mobile user visits client.com/something
, I want them to see mysite.com/mobile/detail.php?i=something&app=1
.
Requirements
- The browser should still show the url on
client.com
or at leastm.client.com
. - The redirect should not break Jquery Mobile (therefore iFrames are out of the question)
- The redirect should be easy to set-up for my client. Ideally a copy and paste of some javascript code.
Here's what I've come up with
I've thought of something, but I'm not sure if it's going to work and IF it's going to work, whether it's a good solution.
- A small javascript would detect a mobile device and redirect to
m.client.com
. - Cname
m.client.com
would redirect tom.mysite.com
m.mysite.com
would point tomysite.com/mobile/
?app=1
would be appended by PHP.
I'm not even sure if that's going to work, and it requires too much effort for my clients.
I am willing to use almost any combination of techniques to achieve this. Javascript, Jquery, DNS zoning, HTAccess or anything else that would be good for it.
What would be the best way to do such a thing?