Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Developing for the anywhere, everywhere web

Developing for the anywhere, everywhere web

We are just now starting to understand and embrace the web for what it truly is—an inherently flexible and responsive medium. As the number of internet-connected devices explodes, we are forced to reassess how we create our sites and applications. We don't know for certain what device our users will be using or where they'll be using them from. All we know is that they will expect to see meaningful content in a design that is tailored to the constraints of the device, and that this content will be delivered to them quickly—no matter where they are.

This session what it means to embrace the inherent flexibility of the web. We will discuss where our current practices and tools fall short. We'll also take a look at how new techniques like responsive enhancement can help.

Tim Kadlec

March 13, 2012
Tweet

More Decks by Tim Kadlec

Other Decks in Programming

Transcript

  1. developing for the anywhere, everywhere web TIM KADLEC Rich Web

    Experience, December 2011 @tkadlec timkadlec.com
  2. TOM BARRETT Chaos in the world brings uneasiness, but it

    also allows the opportunity for creativity and growth.
  3. ANDY HUME http://blog.andyhume.net/responsive-by-default The web is responsive on its own—by

    default. It’s us that’s been breaking it all these years by placing content in fixed- width containers.
  4. JOHN ALLSOPP http://www.alistapart.com/articles/dao/ The web’s greatest strength, I believe, is

    often seen as a limitation, as a defect. It is the nature of the web to be flexible, and it should be our role as designers and developers to embrace this flexibility, and produce pages which, by being flexible, are accessible to all.
  5. KAREN MCGRANE http://5by5.tv/contenttalks/10 This is not about having something that

    looks like Microsoft Word. This is about you creating content that might appear formatted in different ways, structured in different ways, on lots of different platforms. You have to be able to start thinking in systems…
  6. TRENT WALTON http://trentwalton.com/2011/05/10/fit-to-scale/ Responsive web design isn’t about fitting content

    (like repacking a moving van), but about tailoring content to fit the user (like arranging furniture).
  7. var searchNews = function(searchterm) { var elem = document.createElement('script'); elem.src

    = 'http://ajax.googleapis.com/ajax/services/ search/news?v=1.0&q=' + searchterm + '&callback=displayNews'; document.getElementsByTagName('head')[0].appendChild(elem); }; if (document.documentElement.clientWidth > 640) { searchNews('cats'); }
  8. The interconnectedness of all things I'm very glad you asked

    me that, Mrs Rawlinson. The term `holistic' refers to my conviction that what we are concerned with here is the fundamental interconnectedness of all things. I do not concern myself with such petty things as fingerprint powder, telltale pieces of pocket fluff and inane footprints. I see the solution to each problem as being detectable in the pattern and web of the whole. The connections between causes and effects are often much more subtle and complex than we with our rough and ready understanding of the physical world might naturally suppose, Mrs Rawlinson. Let me give you an example. If you go to an acupuncturist with toothache he sticks a needle instead into your thigh. Do you know why he does that, Mrs Rawlinson? No, neither do I, Mrs Rawlinson, but we intend to find out. A pleasure talking to you, Mrs Rawlinson. Goodbye. 16px 36px
  9. body { font-size: 100%; /* 16px */ font-family: Georgia; }

    h1 { font-size: 2.25em; /* 36px/16px = 2.25em */ font-family: Georgia; }
  10. The interconnectedness of all things I'm very glad you asked

    me that, Mrs Rawlinson. The term `holistic' refers to my conviction that what we are concerned with here is the fundamental interconnectedness of all things. I do not concern myself with such petty things as fingerprint powder, telltale pieces of pocket fluff and inane footprints. I see the solution to each problem as being detectable in the pattern and web of the whole. The connections between causes and effects are often much more subtle and complex than we with our rough and ready understanding of the physical world might naturally suppose, Mrs Rawlinson. Let me give you an example. If you go to an acupuncturist with toothache he sticks a needle instead into your thigh. Do you know why he does that, Mrs Rawlinson? No, neither do I, Mrs Rawlinson, but we intend to find out. A pleasure talking to you, Mrs Rawlinson. Goodbye. 100% 2.25em
  11. /* base experience */ @media screen and (min-width: 320px) {....}

    @media screen and (min-width: 600px) {....} @media screen and (min-width: 1300px) {....}
  12. Resizing those images and optimizing them reduces the total file

    size for all six images to 45K. That’s a 78% reduction in file size and download time.
  13. 71% of mobile users expect websites to load as quickly,

    almost as quickly or faster on their mobile phone, compared to the computer they use at home
  14. 60% expect a mobile website to load in 3 seconds

    or less http://www.bizreport.com/2011/07/mobile-web-users-need-for-speed-not-being-satisfied.html
  15. 25% 50% 75% 100% 2009 2011 Category Title 20% 74%

    % of people who will bounce after 5 seconds Source: http://bit.ly/viowVq
  16. http://flic.kr/p/6e7uqr <!-- Basic usage --> <img src='http://src.sencha.io/http://mysite.com/ myimage.png' alt='My image'

    /> <!-- Percentage sizing --> <img src='http://src.sencha.io/x50/http://mysite.com/ myimage.png' alt='My image' /> <!-- Data URI --> <img src='http://src.sencha.io/data/http://mysite.com/ myimage.png' alt='My image' />
  17. http://flic.kr/p/6e7uqr //by width if (screen.width >= 320) { // bring

    the hotness } //by some combination if (localStorage.supported && screen.width >= 320) { //bring the hotness }
  18. http://flic.kr/p/6e7uqr //by media query if (matchMedia('only screen and (max-width: 480px)').matches)

    { // bring the hotness } https://github.com/paulirish/matchMedia.js/
  19. http://robertnyman.com/2011/05/30/discussing-alternatives-for-various-sizes-of-the-same-image-introducing-src-property-in-css-as-an-option/ Text <img src="default.jpg" srclist="alternativeSizes" alt="Picture of Unicorn" /> <sourcelist

    id="alternativeSizes"> <source src="big.jpg" media="min-width: 600px" width="600" height="400" /> <source src="small.jpg" media="max-width: 600px" width="320" height="320" /> </sourcelist>
  20. <?php // If user shows up and doesn't have a

    cookie set if(!isset($_COOKIE['resolution'])) { ?> <script> // Set cookie based on screen size document.cookie='resolution='+ Math.max(screen.width,screen.height)+'; path=/'; location.reload(true); </script> <?php // If user doesn't have JavaScript, they'll just // keep moving past here like nothing happened. } ?>
  21. <?php $res = !empty($_COOKIE['resolution']) ? $_COOKIE['resolution'] : 500; // Arbitrary

    mobile resolution. ?> <body> <?php if($res > 800) { //large screen component } else { //small screen component } ?> </body>
  22. http://flic.kr/p/6e7uqr detect:{ width:function(){ return (window.innerWidth>0)?window.innerWidth:screen.width; }, height:function(){ return (window.innerHeight>0)?window.innerHeight:screen.height; },

    touch:function(){ try{document.createEvent("TouchEvent");return true;} catch(e){return false;} }, json:function(){ return !!window.JSON; }, } http://browser.nokia.com/resources/scripts/ profile.js
  23. JAMES PEARCE http://jeffcroft.com/blog/2011/may/16/serious-excercise/#c166865 I’m fascinated to explore how the web

    can evolve over the next 10 years. I believe that understanding context is at the heart of it – like the speed of light was to turn-of-the-century physicists – and that we should continue to explore the boundaries so as to change the expectations of both creators and users. Or, like those same physicists 120 years ago, do we really think we’ve got it all figured out?
  24. LEWIS CARROLL "Have you guessed the riddle yet?" the Hatter

    said, turning to Alice again. "No, I give it up," Alice replied: "what's the answer?' "I haven't the slightest idea," said the Hatter.
  25. FUTUREFRIEND.LY Our existing standards, workflows, and infrastructure won't hold up.

    Today's onslaught of devices is already pushing them to the breaking point. They can't withstand what's ahead.