making your site mobile-friendly - devcsi reading 21.07.2010

57
Making your site mobile-friendly TIPS AND TECHNIQUES FOR A BETTER MOBILE PRESENCE Patrick H. Lauke / Developing for Mobile Applications in Education / DevCSI / Reading / 21 July 2010

Upload: patrick-lauke

Post on 09-May-2015

3.852 views

Category:

Education


0 download

DESCRIPTION

Extended version of my "Making your site mobile-friendly" talk, including a short look at native applications vs web apps, for the UKOLN DevCSI event "Developing for Mobile Applications in Education" in Reading http://www.ukoln.ac.uk/events/devcsi/mobile_applications/

TRANSCRIPT

Page 1: Making your site mobile-friendly - DevCSI Reading 21.07.2010

Making your site mobile-friendly TIPS AND TECHNIQUES FOR A BETTER MOBILE PRESENCE

Patrick H. Lauke / Developing for Mobile Applications in Education / DevCSI / Reading / 21 July 2010

Page 2: Making your site mobile-friendly - DevCSI Reading 21.07.2010

mobile web is increasingly important

Page 3: Making your site mobile-friendly - DevCSI Reading 21.07.2010

we need a site that works on iPhone

Page 4: Making your site mobile-friendly - DevCSI Reading 21.07.2010

...works on iPhone...oh, and iPad

Page 5: Making your site mobile-friendly - DevCSI Reading 21.07.2010

“remove iPhone from ass”Peter-Paul Koch, The iPhone obsession

www.quirksmode.org/blog/archives/2010/02/the_iphone_obse.html

Page 6: Making your site mobile-friendly - DevCSI Reading 21.07.2010

make your site work on all (most) mobile devices

Page 7: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 8: Making your site mobile-friendly - DevCSI Reading 21.07.2010

1. do nothing

Page 9: Making your site mobile-friendly - DevCSI Reading 21.07.2010

not WAP or text anymore...

Page 10: Making your site mobile-friendly - DevCSI Reading 21.07.2010

mobile browserswill work ok-ish

Page 11: Making your site mobile-friendly - DevCSI Reading 21.07.2010

“But the mobile context...”

Page 12: Making your site mobile-friendly - DevCSI Reading 21.07.2010

2. separate mobile site(m.flickr.com, mobile.mysite.com, ...)

Page 13: Making your site mobile-friendly - DevCSI Reading 21.07.2010

beware browser sniffingphoto: http://www.flickr.com/photos/timdorr/2096272747/

Page 14: Making your site mobile-friendly - DevCSI Reading 21.07.2010

offer users choice:desktop or mobile?

Page 15: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 16: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 17: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 18: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 19: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 20: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 21: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 22: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 23: Making your site mobile-friendly - DevCSI Reading 21.07.2010

refactored for small screen,not dumbed down for mobile

Page 24: Making your site mobile-friendly - DevCSI Reading 21.07.2010

3. single adaptive site

Page 25: Making your site mobile-friendly - DevCSI Reading 21.07.2010

nothing new...fluid layout, progressive enhancement, graceful degradation

Page 26: Making your site mobile-friendly - DevCSI Reading 21.07.2010

CSS 2 Media Types(screen, print, handheld)

Page 27: Making your site mobile-friendly - DevCSI Reading 21.07.2010

CSS 2.1 Media Types

<link rel="stylesheet" ... media="print" href="...">@import url("...") print;@media print { // insert CSS rules here}

Page 28: Making your site mobile-friendly - DevCSI Reading 21.07.2010

CSS 3 Media Queries“...the new hotness” Jeffrey Zeldman

http://www.zeldman.com/2010/04/08/best-aea-yet/

Page 29: Making your site mobile-friendly - DevCSI Reading 21.07.2010

CSS 3 Media Queries

● build and extend CSS 2.1 Media Types● more granular control of capabilities● width, height, orientation, color, resolution, …

http://www.w3.org/TR/css3-mediaqueries/

Page 30: Making your site mobile-friendly - DevCSI Reading 21.07.2010

CSS 3 Media Queries

<link rel="stylesheet" ... media="screen and (max-width:480px)" href="...">@import url("...") screen and (max-width:480px);@media screen and (max-width:480px) { // insert CSS rules here}

Page 31: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 32: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 33: Making your site mobile-friendly - DevCSI Reading 21.07.2010

viewport meta

Page 34: Making your site mobile-friendly - DevCSI Reading 21.07.2010

viewport meta

● desktop: viewport = visible area of browser● mobile: “virtual viewport”, physical pixels, zoom● viewport meta gives hints

Page 35: Making your site mobile-friendly - DevCSI Reading 21.07.2010

viewport meta

<meta name="viewport" content="width=device-width"><meta name="viewport" content="width=320, initial-scale=2.3,user-scalable=no">http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html

Page 36: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 37: Making your site mobile-friendly - DevCSI Reading 21.07.2010

minimise dataand server requests

(minify JavaScript, combine CSS, …)

Page 38: Making your site mobile-friendly - DevCSI Reading 21.07.2010

minimise data

● data transfer over network can be slow● compress images (PNGCrush)● optimise your HTML (death to div-itis)● minify JavaScript● combine CSS

Page 39: Making your site mobile-friendly - DevCSI Reading 21.07.2010

minimise server requests

● each request has overhead● limit to concurrent requests● caching not reliable (e.g. iPhone > 25Kb)

Page 40: Making your site mobile-friendly - DevCSI Reading 21.07.2010

CSS spritesDave Shea, A List Apartwww.alistapart.com/articles/sprites

Page 41: Making your site mobile-friendly - DevCSI Reading 21.07.2010

width: 50px; height: 50px;background: url(icons.gif) no-repeat -51px 0;

Page 42: Making your site mobile-friendly - DevCSI Reading 21.07.2010

data URLshttp://software.hixie.ch/utilities/cgi/data/data

Page 43: Making your site mobile-friendly - DevCSI Reading 21.07.2010

data URLs

<img width="48" height="48" alt="Redux gravatar" src="data:image/jpeg,%FF%D8%FF%E0%00%10JFIF%00%01%01%01%00H%00H%00%00%FF% … ">h1 {

background: url("data:image/jpeg,%FF%D8%FF%E0%00%10JFIF%00%01 … ") no-repeat left top;}

Page 44: Making your site mobile-friendly - DevCSI Reading 21.07.2010

native app vs web app

Page 45: Making your site mobile-friendly - DevCSI Reading 21.07.2010

HTML5<!DOCTYPE html>

Page 46: Making your site mobile-friendly - DevCSI Reading 21.07.2010

video, audio and canvas on any devicewithout plugins

(Java / Flash / Silverlight not ubiquitous)

Page 47: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 48: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 49: Making your site mobile-friendly - DevCSI Reading 21.07.2010
Page 50: Making your site mobile-friendly - DevCSI Reading 21.07.2010

HTML5 (and friends) haslots more APIs for developers

(for powerful client-side apps)

Page 51: Making your site mobile-friendly - DevCSI Reading 21.07.2010

isgeolocationpartofhtml5.com

Page 52: Making your site mobile-friendly - DevCSI Reading 21.07.2010

geolocationnavigator.geolocation.getCurrentPosition(success, error);navigator.geolocation.watchCurrentPosition(success, error);function success(position) {

/* where's Wally? */var lat = position.coords.latitude;var long = position.coords.longitude;...

}

Page 53: Making your site mobile-friendly - DevCSI Reading 21.07.2010

offline detection...

window.addEventListener('online', function(){ … }, true);window.addEventListener('offline', function(){ … }, true);

Page 54: Making your site mobile-friendly - DevCSI Reading 21.07.2010

application cache<html manifest=”blah.manifest”>CACHE MANIFESTimages/sprites.pngscripts/common.jsscripts/jquery.jsstyles/global.cssdata.xmlNETWORK:resources/news.xmlFALLBACK:images/ offline/not-available.png

Page 55: Making your site mobile-friendly - DevCSI Reading 21.07.2010

…and more (coming)WebGL, <device>, Contacts API …

Page 56: Making your site mobile-friendly - DevCSI Reading 21.07.2010

1. do nothing2. separate mobile site3. single adaptive site

Page 57: Making your site mobile-friendly - DevCSI Reading 21.07.2010

www.opera.com/[email protected]

people.opera.com/patrickl/presentations/devcsi-mobile_21.07.2010/devcsi-mobile_21.07.2010.pdf