Droidcon 04.11.2009

Post on 17-Dec-2014

568 views 0 download

description

 

Transcript of Droidcon 04.11.2009

Optimising sites for mobile

Patrick H. Lauke / Droidcon / Berlin / 4 November 2009

TIPS FOR MOBILE AND CROSS-DEVICE WEB DEVELOPMENT

web evangelist at Opera

Opera – one browser on many devices

Mobile web is an uneven landscape:

● Full Web (Android Browser, Opera Mobile, …)● Constrained browsers – WAP, limited standards support, proprietary markup● Proxy-based (Opera Mini, …)● Games consoles / portables

Mobile capabilities also vary:

● Screen size● Input mechanism – touch, keypad, other?● Memory and processing power● Colour palettes● Native font● Connection speed / quality

One Web means making, as far as is reasonable, the same information and services available to users irrespective of the device they are using. However, it does not mean that exactly the same information is available in exactly the same representation across all devices.

W3C Mobile Web Best Practices http://www.w3.org/TR/mobile-bp/#OneWeb

Approaches to mobile web development:

● Do nothing – use standards, defensive design● Separate site (m.mysite.com, mysite.mobi)● Single site, but optimised for cross-device

Server-side detection of mobile:

● “Browser sniffing” the User Agent stringOpera/9.80 (J2ME/MIDP; Opera Mini/5.0.2056/866; U; en) Presto/2.2

● When pattern matching can go wrong...● Offer users a way back (example of Orkut)

Client-side detection of mobile:

● “Browser sniffing” the User Agent string again● “Capability sniffing” reliant on JavaScript● CSS 2.1 Media Types● CSS 3 Media Queries

CSS 2.1 Media Types:

● Print, screen, handheld, projection, tv, …● Partially supported● Lump all devices into single categories

http://www.w3.org/TR/CSS21/media.html

CSS 2.1 Media Types:

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

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/

CSS 3 Media Queries:

@media screen and (max-device-width: 480px) { // insert CSS rules here

}Demonstration of Media Queries

CSS 3 Media Queries and SVG:

● SVG already resolution independent● Ideal for device interfaces, maps, graphs, …● Combination with CSS 3 Media Queries

Demonstration of Media Queries + SVG

SVG in OBJECT, CSS and IMG element*native inclusion in HTML5?

*only in Opera at the moment

And beyond that?

● Mobile Web Best Practices● Mobile Web Applications Best Practices

http://www.w3.org/TR/mobile-bp/http://www.w3.org/TR/mwabp/

Crossover with accessibility:

● accessibility = extreme usability?● deaf/blind/colourblind/mobility impaired● Mobile Web Best Practices vs WCAG 2.0

http://www.w3.org/TR/mwbp-wcag/

call to arms action

www.opera.com/developerpatrick.lauke@opera.com