html5 maintenant partie 2 : apis

49
Forms - comportement Déclaratif et standardisé

Upload: jean-pierre-vincent

Post on 26-May-2015

1.900 views

Category:

Technology


2 download

DESCRIPTION

2ème volet de la présentation HTML5 maintenant : géolocalisation, nouveau formulaires, et Web storage au menu, afin de voir ce qu'il est possible d'utiliser dès aujourd'hui, et à quelles conditions

TRANSCRIPT

Page 1: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

Page 2: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

<input type=number

/>

Page 3: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

<input type=numberplaceholder="Combien ?"

/>

Page 4: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

<input type=numberplaceholder="Combien ?"required

/>

Page 5: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

<input type=numberplaceholder="Combien ?"requiredautofocus

/>

Page 6: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

<input type=numberplaceholder="Combien ?"requiredautofocusmax=10

/>

Page 7: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

<input type=

/>

Page 8: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

<input type=text

/>

Page 9: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

<input type=textrequired

/>

Page 10: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

<input type=textrequiredpattern="[a-zA-Z]{5,10}"/>

Page 11: HTML5 maintenant partie 2 : APIs

Forms - comportementDéclaratif et standardisé

<input type=textrequiredpattern="[a-zA-Z]{5,10}"/>

bit.ly/form2_demo

Page 12: HTML5 maintenant partie 2 : APIs

Forms - comportementGain ?

Standard=

AccessibilitéFacilité de codage

Page 13: HTML5 maintenant partie 2 : APIs

Forms - comportementEmulation :

Page 14: HTML5 maintenant partie 2 : APIs

Forms - comportementEmulation :

● H5Fbit.ly/lib_H5F

Page 15: HTML5 maintenant partie 2 : APIs

Forms - comportementEmulation :

● H5Fbit.ly/lib_H5F

● Webforms2bit.ly/lib_WF2

Page 16: HTML5 maintenant partie 2 : APIs

Forms - comportementEmulation :

● H5Fbit.ly/lib_H5F

● Webforms2bit.ly/lib_WF2

bit.ly/form2_demo

Page 17: HTML5 maintenant partie 2 : APIs

Forms - bilan

Validation : ✓ OK pour création ✓ OK pour enrichissement⚠Modification : au cas par cas

Page 18: HTML5 maintenant partie 2 : APIs

Geolocation

Vous êtes ici

Page 19: HTML5 maintenant partie 2 : APIs

Geolocation● Sorti d'HTML5● Candidate Recommendation● A la mode :

• Twitter• Facebook• Foursquare

● Mobile et bureau● Remplace la détection par IP● Accès au matériel (GPS, wifi)

Page 20: HTML5 maintenant partie 2 : APIs

Géolocation

bit.ly/geoloc_demo

Page 21: HTML5 maintenant partie 2 : APIs

Géolocation

bit.ly/geoloc_demo

Natif

Page 22: HTML5 maintenant partie 2 : APIs

Géolocation

bit.ly/geoloc_demo

Natif Détection IP

Page 23: HTML5 maintenant partie 2 : APIs

Géolocation

bit.ly/geoloc_demo

Natif Détection IP

4km

Page 24: HTML5 maintenant partie 2 : APIs

Geolocation

✓ Firefox 3.5+✓ Chrome 5+✓ Safari 5+✓ Opéra✓ Webkit mobile avec GPS

Implémentations concordantes !Basés sur Google Location Service

Page 25: HTML5 maintenant partie 2 : APIs

Geolocationwindow.navigator.geolocation

Page 26: HTML5 maintenant partie 2 : APIs

Geolocationwindow.navigator.geolocation .getCurrentPosition( )

Page 27: HTML5 maintenant partie 2 : APIs

Geolocationwindow.navigator.geolocation .getCurrentPosition(fSuccess)

Page 28: HTML5 maintenant partie 2 : APIs

Geolocationwindow.navigator.geolocation .getCurrentPosition(fSuccess)

Page 29: HTML5 maintenant partie 2 : APIs

Geolocationwindow.navigator.geolocation .getCurrentPosition(fSuccess)

fSuccess = function(oPosition) { oPosition.coords.longitude;

oPosition.coords.latitude;};

Page 30: HTML5 maintenant partie 2 : APIs

Geolocation alternatives

● Achat de bases IP/ville (gros site)• Démo IE6 : bit.ly/geoloc_demo

● YQL-Geo-Library (bit.ly/lib_geo)• Pur JS• Services google apps + YQL• 4ko

Page 31: HTML5 maintenant partie 2 : APIs

Geolocation

✓ Utilisable en production

Page 32: HTML5 maintenant partie 2 : APIs

Web Storage

Page 33: HTML5 maintenant partie 2 : APIs

Web Storage● Comme un cookie :

• Clé / valeur• Persistant ou non

● Mieux qu'un cookie :• > 4k• Performances OK

Page 34: HTML5 maintenant partie 2 : APIs

Web Storage

window.localStorage {.setItem( key, value ).getItem( key ).removeItem( key )

}

bit.ly/spec_storage

Page 35: HTML5 maintenant partie 2 : APIs

Web StorageStocker quoi ?

● Longues listes• Pays, régions, ville• Marque / modèles

● Données de page en page● Cache pour texte utilisateur● Etat d'une application pour l'offline

bit.ly/demo_storage

Page 36: HTML5 maintenant partie 2 : APIs

Web StorageSupport

Page 37: HTML5 maintenant partie 2 : APIs

Web StorageSupport

● IE 6-7 !

Page 38: HTML5 maintenant partie 2 : APIs

Web StorageSupport

⚠ IE 6-7 (userData, 64k ) : bit.ly/userData

Page 39: HTML5 maintenant partie 2 : APIs

Web StorageSupport

⚠ IE 6-7 (userData, 64k ) : bit.ly/userData

⚠ IE 8 (10Mo, asynchrone, string)

Page 40: HTML5 maintenant partie 2 : APIs

Web StorageSupport

⚠ IE 6-7 (userData, 64k ) : bit.ly/userData

⚠ IE 8 (10Mo, asynchrone, string)

⚠ FF2, FF3 (globalStorage, string)

Page 41: HTML5 maintenant partie 2 : APIs

Web StorageSupport

⚠ IE 6-7 (userData, 64k ) : bit.ly/userData

⚠ IE 8 (10Mo, asynchrone, string)

⚠ FF2, FF3 (globalStorage, string)

✓ FF3.5, Safari, Chrome,Opéra (5Mo)

Page 42: HTML5 maintenant partie 2 : APIs

Web StorageAlternatives :

Page 43: HTML5 maintenant partie 2 : APIs

Web StorageAlternatives :

● Flash shared object ✓ 100K, extensible à l'infini

⚠ permission utilisateur

Page 44: HTML5 maintenant partie 2 : APIs

Web StorageAlternatives :

● Flash shared object ✓ 100K, extensible à l'infini

⚠ permission utilisateur

● window.name (hack) ✓ in(dé)fini

⚠ Performances ?

Page 45: HTML5 maintenant partie 2 : APIs

Web StorageDéveloppeur Librairie

Page 46: HTML5 maintenant partie 2 : APIs

Web StorageIE UserData :

• jQuery jStorage (jstorage.info)• YUI3 Storage lite (bit.ly/lib_store1)

Flash shared object :• YUI2 Storage (yhoo.it/lib_store2)

window.name :• sessionstorage (bit.ly/lib_store3)

Page 47: HTML5 maintenant partie 2 : APIs

Web StorageIE UserData :

• jQuery jStorage (jstorage.info)• YUI3 Storage lite (bit.ly/lib_store1)

Flash shared object : ✓ YUI2 Storage (yhoo.it/lib_store2)

window.name :• sessionstorage (bit.ly/lib_store3)

Page 48: HTML5 maintenant partie 2 : APIs

Web Storage

Démo IE6, avec YUI3 storage lite

bit.ly/demo_storage

Page 49: HTML5 maintenant partie 2 : APIs

Web StorageConclusion

✓ OK pour la prod (je l'ai fait)

⚠ IE fiable < 64k ou 100k