Alternatives to RWD
Do nothing (ignore mobile)
Use a separate m-dot site
Slide 24
Slide 24 text
Ignore Mobile?
“Mobile internet adoption has outpaced
desktop internet adoption by eight
times.”
http://www.lukew.com/ff/entry.asp?993
Alternatives to RWD
Slide 25
Slide 25 text
Ignore Mobile?
Alternatives to RWD
http://gs.statcounter.com/#desktop+mobile+tablet-comparison-ww-monthly-200901-201412
Slide 26
Slide 26 text
Use a Separate mdot Site
Redirects are slow.
Maintenance of UA-Parsing
Server Side
Content Strategy (Desktop Mode link)
Alternatives to RWD
Slide 27
Slide 27 text
Redirects are Slow
“…redirects slow down the user experience. Inserting a
redirect between the user and the HTML document delays
everything in the page…”
http://developer.yahoo.com/performance/rules.html#redirects
“Minimizing HTTP redirects from one URL to another
cuts out additional RTTs and wait time for users.”
https://developers.google.com/speed/docs/best-practices/rtt#AvoidRedirects
Use a separate mdot Site
Slide 28
Slide 28 text
Maintain UA-Parsing Server Side Code
WURFL updates
about once a month
Use a separate mdot Site
http://wurfl.sourceforge.net/
Slide 29
Slide 29 text
“Get to a point with your web
strategy where you don't crap your
pants every time Apple has a
keynote.”
Slide 30
Slide 30 text
http://en.m.wikipedia.org/
Content Strategy
Use a separate mdot Site
Slide 31
Slide 31 text
Content Strategy
http://en.wikipedia.org/
Use a separate mdot Site
Slide 32
Slide 32 text
Content Strategy
Use a separate mdot Site
Slide 33
Slide 33 text
“Mobile users want to see our menu,
hours, and delivery number. Desktop
users definitely want this 1mb png of
someone smiling at a salad.”
https://twitter.com/wilto/status/63284673723375616
Slide 34
Slide 34 text
No content
Slide 35
Slide 35 text
CSS
Slide 36
Slide 36 text
The Problems
Browsers Download and Block Rendering
on Unnecessary CSS
Browsers Sometimes Download
Unnecessary Images
Big Images are Wasted on Small Screens
Retina Images are Wasted on
Blurry Screens
Slide 37
Slide 37 text
The “Average” Web Page
http://httparchive.org/interesting.php#bytesperpage
Slide 38
Slide 38 text
JavaScript Can Block
“With scripts, progressive rendering is
blocked for all content below the script.”
http://developer.yahoo.com/blogs/ydn/posts/2007/07/high_performanc_5/
Slide 39
Slide 39 text
JavaScript that Doesn’t Block
Slide 40
Slide 40 text
JavaScript that Doesn’t Block
http://calendar.perfplanet.com/2010/the-truth-about-non-blocking-javascript/
Slide 41
Slide 41 text
JavaScript that Doesn’t Block
var
script
=
document.createElement("script");
script.type
=
"text/javascript";
script.src
=
"foo.js";
var
ref
=
document.getElementsByTagName('script')[0];
ref.parentNode.insertBefore(script,
ref);
http://calendar.perfplanet.com/2010/the-truth-about-non-blocking-javascript/
http://paulirish.com/2011/surefire-dom-element-insertion/
Slide 42
Slide 42 text
Stylesheets Block
“Browsers (except Opera) block rendering until all
screen CSS arrives. With the worst possible experience:
white page.”
“Browsers download CSS they don't need, e.g. print, tv,
device-ratio... And most browsers (except Opera and
Webkit) block rendering because of these too”
Demo:
http://www.phpied.com/files/css-loading/mq.php?mq=all
http://www.phpied.com/css-and-the-critical-path/
Downloading CSS
Firefox 35
Opera 26
Chrome 39
Safari 8
Slide 47
Slide 47 text
Solutions
CSS is sacred. Choose minimal when possible.
Separate elements for each breakpoint
Doesn’t scale.
Good for WebKit, what about everything else?
Separate out and inline your Critical CSS.
…
/*
inline
critical.css
here
*/
//
loadCSS
utility
omitted
for
brevity
loadCSS(
"complete-‐sheet.css"
);
…
Slide 53
Slide 53 text
LOADCSS
https://github.com/filamentgroup/loadCSS
Slide 54
Slide 54 text
How we make RWD sites
load fast as heck
http://www.filamentgroup.com/lab/performance-rwd.html
Slide 55
Slide 55 text
Images
Slide 56
Slide 56 text
Images Don’t Block
Doesn’t mean they get a free pass.
Slide 57
Slide 57 text
Images Don’t Block
Doesn’t mean they get a free pass.
1,248 KB
Slide 58
Slide 58 text
Taxonomy of Images
CSS Background Images
HTML
Responsive Images
Slide 59
Slide 59 text
hidden in CSS
@media
all
and
(max-‐width:
600px)
{
#test1
{
display:none;
}
}
http://timkadlec.com/2012/04/media-query-asset-downloading-results/
Downloading Images
Slide 60
Slide 60 text
hidden in CSS
@media
all
and
(max-‐width:
600px)
{
#test1
{
display:none;
}
}
http://timkadlec.com/2012/04/media-query-asset-downloading-results/
NOPE
Downloading Images
Slide 61
Slide 61 text
#test2
{
background-‐image:url('images/test2.png');
width:200px;
height:75px;
}
@media
all
and
(max-‐width:
600px)
{
#test2
{display:none;}
}
http://timkadlec.com/2012/04/media-query-asset-downloading-results/
CSS background image hidden in CSS
Downloading Images
Slide 62
Slide 62 text
#test2
{
background-‐image:url('images/test2.png');
width:200px;
height:75px;
}
@media
all
and
(max-‐width:
600px)
{
#test2
{display:none;}
}
http://timkadlec.com/2012/04/media-query-asset-downloading-results/
NOPE
CSS background image hidden in CSS
Downloading Images
Slide 63
Slide 63 text
#test3
div
{
background-‐image:url('images/test3.png');
width:200px;
height:75px;
}
@media
all
and
(max-‐width:
600px)
{
#test3
{
display:none;
}
}
http://timkadlec.com/2012/04/media-query-asset-downloading-results/
CSS background image
on child hidden in CSS
Downloading Images
Slide 64
Slide 64 text
#test3
div
{
background-‐image:url('images/test3.png');
width:200px;
height:75px;
}
@media
all
and
(max-‐width:
600px)
{
#test3
{
display:none;
}
}
http://timkadlec.com/2012/04/media-query-asset-downloading-results/
OK
CSS background image
on child hidden in CSS
Downloading Images
Slide 65
Slide 65 text
#test4
{
background-‐image:url('images/test4-‐desktop.png');
width:200px;
height:75px;
}
@media
all
and
(max-‐width:
600px)
{
#test4
{
background-‐image:url('images/test4-‐mobile.png');
}
}
http://timkadlec.com/2012/04/media-query-asset-downloading-results/
CSS background image replaced in CSS
Downloading Images
Slide 66
Slide 66 text
#test4
{
background-‐image:url('images/test4-‐desktop.png');
width:200px;
height:75px;
}
@media
all
and
(max-‐width:
600px)
{
#test4
{
background-‐image:url('images/test4-‐mobile.png');
}
}
http://timkadlec.com/2012/04/media-query-asset-downloading-results/
~OK
CSS background image replaced in CSS
Downloading Images
Slide 67
Slide 67 text
#test7
{
background-‐image:url('images/test7-‐lowres.png');
width:200px;
height:75px;
}
@media
only
screen
and
(-‐webkit-‐min-‐device-‐pixel-‐ratio:
1.5),
only
screen
and
(min-‐-‐moz-‐device-‐pixel-‐ratio:
1.5),
only
screen
and
(-‐o-‐min-‐device-‐pixel-‐ratio:
3/2),
only
screen
and
(min-‐device-‐pixel-‐ratio:
1.5)
{
#test7
{
background-‐image:url('images/test7-‐highres.png');
width:200px;
height:75px;
/*
Editors
note:
this
should
use
background-‐size
*/
}
}
http://timkadlec.com/2012/04/media-query-asset-downloading-results/
CSS background image replaced in CSS
Downloading Images
Slide 68
Slide 68 text
#test7
{
background-‐image:url('images/test7-‐lowres.png');
width:200px;
height:75px;
}
@media
only
screen
and
(-‐webkit-‐min-‐device-‐pixel-‐ratio:
1.5),
only
screen
and
(min-‐-‐moz-‐device-‐pixel-‐ratio:
1.5),
only
screen
and
(-‐o-‐min-‐device-‐pixel-‐ratio:
3/2),
only
screen
and
(min-‐device-‐pixel-‐ratio:
1.5)
{
#test7
{
background-‐image:url('images/test7-‐highres.png');
width:200px;
height:75px;
/*
Editors
note:
this
should
use
background-‐size
*/
}
}
http://timkadlec.com/2012/04/media-query-asset-downloading-results/
OK
CSS background image replaced in CSS
Downloading Images
CSS Font Loading
http://dev.w3.org/csswg/css-font-loading/
Slide 99
Slide 99 text
var
doc
=
document,
docEl
=
doc.documentElement;
doc.fonts.load("1em
Raleway")
.then(function()
{
//
The
font
has
loaded.
docEl.className
+=
"
raleway-‐loaded";
});
Slide 100
Slide 100 text
body
{
font-‐family:
sans-‐serif;
}
.raleway-‐loaded
body
{
font-‐family:
Raleway,
sans-‐serif;
}
Slide 101
Slide 101 text
FONTFACEONLOAD
github.com/zachleat/fontfaceonload
(GZIP)
1.5KB JS
USES THE CSS FONT LOADING API WHEN AVAILABLE.
Slide 102
Slide 102 text
Buzzkills
Slide 103
Slide 103 text
Advertising
Full of document.write, iframes,
blocking JavaScript (errors come
for free) and general badness.
Trick: Inject advertising iframes
using JavaScript (after onload)
document.createElement('iframe');
Slide 104
Slide 104 text
Social Networking Widgets
http://yslow.org/phantomjs/