#139: Explaining the Server Side Mustard Cut

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.

Comments

  1. User Avatar
    Deryck Henson
    Permalink to comment#

    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.

  2. User Avatar
    Mark Fischer, Jr.

    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):

    // Hit /setcookie.php?cookieval=whatever&cookiename=something with your js
    $cookieval = $_GET['cookieval'];
    $cookiename = $_GET['cookiname'];
    
    $_COOKIE[$cookiename] = $cookieval;
    

    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.

Submit a Comment

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

icon-closeicon-emailicon-linkicon-logo-staricon-menuicon-searchicon-staricon-tag