I published a written post about this idea of the Server Side Mustard Cut. So if you’re into reading and checking out code samples and stuff, that’s the place for you. In this video I just walk through all that, explaining myself as we go.
I’ll give the same caveat I have everywhere else I’ve introduced this: this may not be perfect for every site out there. In fact I think normal RWD stuff is generally better, up to and including ajaxing for different JavaScript and stylesheets. This is for when you need entirely different documents and you want to base that on client-side data.
Here’s the live demo and the GitHub repo.
This would be a nice column for someone to do, like how the CSS guides were all released around the same time (yours, github, etc). I’d be interested in seeing how other sites of equal or higher calibre handle this issue (calibre in terms of traffic volume and browser/client setup diversity).
Thanks for the insight, Chris.
PS – Seriously ashamed I didn’t consider cookies were sent with EVERY HTTP REQUEST til you just mentioned it.
A workaround to the server not being able to get client-set cookies would be to do an AJAX call in your JS to some page on your server like this (PHP):
Disclaimer:
Just a proof-of-concept, not tested, and I haven’t written PHP in a couple months now so please don’t yell at me.