• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
The Server Side of Responsive Web Design
 

The Server Side of Responsive Web Design

on

  • 7,417 views

Responsive web design has become an important tool for front-end developers as they develop mobile-optimized solutions for clients. Browser-detection has been an important tool for server-side ...

Responsive web design has become an important tool for front-end developers as they develop mobile-optimized solutions for clients. Browser-detection has been an important tool for server-side developers for the same task for much longer. Unfortunately, both techniques have certain limitations. Depending on project requirements, team make-up and deployment environment combining these two techniques might lead to intriguing solutions for your organization. We'll discuss when it makes sense to take this extra step and we'll explore techniques for combining server-side technology, like server-side feature-detection, with your responsive web designs to deliver the most flexible solutions possible.

Statistics

Views

Total Views
7,417
Views on SlideShare
5,844
Embed Views
1,573

Actions

Likes
22
Downloads
143
Comments
0

15 Embeds 1,573

http://dmolsen.com 1223
http://www.dmolsen.com 144
https://twitter.com 112
http://www.scoop.it 27
http://cloud.feedly.com 22
http://eduniverse.org 18
http://jmbwiki01.jmberlin.de 6
http://www.eduniverse.org 5
http://preview-local.dmolsen.com 5
http://digg.com 4
http://feeds.feedburner.com 3
http://feedproxy.google.com 1
http://fever.adamworrall.com 1
https://www.google.co.in 1
http://feedly.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    The Server Side of Responsive Web Design The Server Side of Responsive Web Design Presentation Transcript

    • The Server-side of Responsive Design Dave Olsen, @dmolsen WVU University Relations - Web Breaking Development, October 2013
    • “The Server-side?”
    • Was This Your First Reaction? http://flic.kr/p/xdsh
    • “You’re a Smartphone Browser!” http:/ /xkcd.com/869/
    • A Lot Riding on a Part of a Single String One small piece of data. Assumptions
    • The Responsive Age
    • Responsive Design vs. Server-side http://flic.kr/p/6JVLMd
    • Why Be Responsive? One... http://flic.kr/p/5pGcyx
    • Why Be Responsive? One... URL. Set of content. Set of mark-up. Deployment.
    • We Have to Be futurefriend.ly
    • Time to Party! balloons http://flic.kr/p/h6McT
    • “Not so fast, my friends...” http://flic.kr/p/8x6b8X
    • © Brad Frost brad’s iceberg
    • © Brad Frost brad’s iceberg
    • False Sense of Security? This shit can be complicated. Assumptions
    • Maybe it’s not so simple... Responsive Design vs. Server-side http://flic.kr/p/6JVLMd
    • Maybe instead it could be... Responsive Design & Server-side http://flic.kr/p/6JVLMd
    • A New Hope? Especially if we can be future-friendly on the server-side too.
    • http://flic.kr/p/agyEkb
    • How do we combine them?
    • What is RESS? RESS Responsive Web Design + Server Side Components I have no idea what becomes of the W, D, or C
    • What is RESS? In a nutshell, RESS combines adaptive layouts with server side component (not full page) optimization. - Luke Wroblewski @lukew http:/ /www.lukew.com/ff/entry.asp?1392
    • What is RESS? Swap HTML components (from those avail on server) in a RWD to further optimize page/app. - Luke Wroblewski @lukew https:/ /twitter.com/lukew/status/275678033661272064
    • Responsive Design is Our Baseline http://flic.kr/p/9UmsCJ
    • To Be Absolutely Clear Server-side components are an enhancement. Provide the good default/fallback with “RE” and optimize the experience with “SS”.
    • Server-side Swapping... Simple Example: Swapping an Image Mobile View Desktop View http://www.lukew.com/ff/entry.asp?1392
    • Server-side Swapping... Simple Example: Swapping an Image index.html userimg.html mobile_userimg.html http:/ /www.lukew.com/ff/entry.asp?1392
    • Server-side Swapping... Simple Example: Swapping an Image <img class="userimage" width="50" height="50" alt="{{ username }}" src="{{ smluserimg }}"> <img class="biguserimage" height="300" width="300" alt="{{ username }}" src="{{ biguserimg }}"> http:/ /www.lukew.com/ff/entry.asp?1392
    • Ultimately, RESS is a Scalpel
    • MOBILE WEB TABLET WEB DESKTOP WEB It’s All One Web
    • When Does RESS Make Sense? http://flic.kr/p/b6WaSP
    • RESS Works Well If... • If you want layout adjustments across devices. • And optimization at the component level to increase performance or tune user experience. • You trust server-side device detection with sensible defaults. - Luke Wroblewski @lukew http:/ /www.lukew.com/ff/entry.asp?1509
    • My Experience On When It Makes Sense • Team has a mix of skills. • Team members are not strong in the skills necessary for complex RWD interactions. • Design elements need to be swapped based on known functionality or performance issues.
    • RESS Works Well If... 1.5 MB The average weight of a home page today. Source: HTTP Archive CSS 77% HTML JavaScript Other Flash Images
    • It’s a Tool in the Toolbox
    • RESS Can Be A Bridge http:/ /flic.kr/p/7FyCB2
    • How Do We Implement RESS? So how would we implement? http://flic.kr/p/5ATc7g
    • Skipping Responsive Design... Responsive Web Design is “easy” http://flic.kr/p/4YM8
    • Two Types of RESS #1 Server-side Driven #2 Client-side Driven
    • Two Types of RESS #1 Server-side Driven
    • Two Possible Solutions Server-side Solutions http://flic.kr/p/9jatna
    • Two Server-Side Options #1 Browser Detection
    • Been Around a Long Time Old dog http://flic.kr/p/bWQicm
    • It’s Used A Lot 82% of the Alexa 100 top sites use some form of server-side mobile device detection to serve content on their main website entry point. - Ronan Cremin @xbs http://www.circleid.com/posts/20120111_analysis_of_server_side_mobile_web_detection/
    • There Are Robust Solutions ScientiaMobile DeviceAtlas 51Degrees.mobi
    • A Word About Open Source
    • Is it an Arms Race? http://flic.kr/p/6RVLY2
    • Is it an Arms Race? Yes, but so is everything in web development. just look at the Modernizr issue tracker
    • Two Server-Side Options #2 Server-side Feature Detection
    • Implementations Are In Their Infancy... Infancy http://flic.kr/p/7B7uyp
    • The Idea Has Been Around for Awhile http://flic.kr/p/d34hh3
    • Taking a Cue From Front-end Dev
    • Modernizr Server
    • Can the Server Be Future-Friendly?
    • Server-side Feature Detection Options #1 Server-side Breakpoints
    • #1: Server-side Breakpoints 320px 640px 960px
    • #1: Server-side Breakpoints Simple Example: Setting a file path based on window.innerWidth <script type="text/javascript"> function writeCookie(name, value) { //cookie code } // store the innerWidth of the window in a cookie writeCookie("RESS", window.innerWidth); </script> http:/ /www.netmagazine.com/tutorials/getting-started-ress
    • #1: Server-side Breakpoints Simple Example: Setting a file path based on window.innerWidth <?php // grab the cookie value $screenWidth = $_COOKIE[‘RESS’]; // set the img path var if ($screenWidth <= 320) { $imgPath = “320”; } else if ($screenWidth < 960) { $imgPath = “640”; } else { $imgPath = “960”; } // print out our image link print “<img src=‘/rwd/images/”.$imgPath.”/car.jpg’ alt=‘Car’ />”; ?> http:/ /www.netmagazine.com/tutorials/getting-started-ress
    • Server-side Feature Detection Options #2 Robust Feature Detection
    • #2: Robust Feature Detection ...feature tests should only ever be run when you don’t know the UA you’re running in. - Alex Russell, Jan. 2011 @slightlylate http:/ /infrequently.org/2011/01/cutting-the-interrogation-short/
    • #2: Robust Feature Detection
    • #2: Robust Feature Detection Simple Example: Inserting a video link <?php // require Detector to identify browser & populate $ua require("lib/Detector/Detector.php"); $html5Embed = "<iframe {...} ></iframe>"; $simpleLink = "Your browser doesn't appear to support HTML5. {...}"; ! ! ! // use the $ua properties to switch if ($ua->video->h264 || $ua->video->webm) { print $html5Embed; } else { print $simpleLink; } ?> http:/ /detector.dmolsen.com/demo/ytembed/
    • #2: Robust Feature Detection Complicated Example: Templates Using Detector & Mustache http:/ /ress.dmolsen.com/
    • MOBILE BASIC M-ADVANCED DESKTOP WEB ress.dmolsen.com
    • Example: West Virginia University
    • Example: West Virginia University Goals/Issues: • Modifying the carousel for retina & code • Modify mark-up for IE 7 & 8 • Provide a non-responsive baseline • Deliver the “correct” mark-up • Fast turnaround Implementation: • Detector for classification • Mustache for templates • YAML for data storage
    • Example: West Virginia University Hybrid Example: Mixing Types of Detection { { "mobile-advanced-ie": { "isMobile": true, "browser": "IE Mobile" }, "mobile-advanced-retina": { "isMobile": true, "hirescapable": true }, "mobile-advanced": { "isMobile": true, "features": [ "csstransforms" ] }, "mobile-basic": { "isMobile": true }, "ie": { "browser": "IE", "major": "7||8" } }
    • MOBILE BASIC M-ADVANCED DESKTOP WEB wvu.edu
    • Example: West Virginia University 700K 700K 700K 700K 525K 525K 525K 525K 350K 350K 350K 350K 175K 175K 175K 175K 0K Total Images JS CSS HTML Default 0K Total Images JS CSS HTML Mobile Retina 0K Total Images JS CSS HTML Mobile Advanced 0K Total Images JS CSS HTML Mobile Basic
    • Example: West Virginia University 100% 75% 50% 25% 0% 2011 2012 2013 Mobile Traffic on First Day of Fall Semester
    • Two Types of RESS #2 Client-side Driven
    • Client-side: Cutting the Mustard
    • Client-side Example: An Event Apart
    • Client-side Example: An Event Apart Example: Fetching Content by Breakpoint $(window).bind(“enterBreakpoint600”, function () { if (bigLoaded == false) { if ($("#slide-show").length > 0) { $("#slide-show").load("/main/heroes", function () { ... }); }; }; }); $(window).bind(“enterBreakpoint1”, function () { if (smallLoaded == false) { $("#event-thumbnail-holder").load("/main/small-heroes", function () { ... }); }; }); source bastardized from http://aneventapart.com
    • Client-side Example: An Event Apart
    • LESS THAN 600PX 600PX+ aneventapart.com
    • Client-side Example: An Event Apart 500K 500K 375K 375K 250K 250K 125K 125K 0K Total Images JS CSS HTML XHR Fonts Greater than 600px 0K Total Images JS CSS HTML XHR Fonts Less than 600px They get bonus points for also using lazy loading.
    • Challenges for RESS http://flic.kr/p/9wF2S
    • Challenges for RESS RESS isn’t a silver bullet. anymore than RWD is
    • Challenges for RESS Server-side feature detection can be spoofed.
    • Challenges for RESS Requires server-side languages. if you go the server-side route
    • Challenges for RESS Data needs to be strongly separated from layout.
    • Challenges for RESS Need to properly set cache headers.
    • Are Client-Hints the Future of RESS?
    • http://flic.kr/p/c74N1
    • http://flic.kr/p/agyEkb
    • Questions or comments?
    • Thanks for Listening Dave Olsen Professional Technologist West Virginia University @dmolsen dmolsen.com