SlideShare a Scribd company logo
1 of 71
Download to read offline
PITFALLS AND HELPERS
   Mobile HTML5 Applications
My name is Rob Hawkes, I’m one of the Technical Evangelists at Mozilla.

My focus is games, most recently around Firefox OS and mobile.
I’m also British, if you hadn’t already guessed.

Photo: http://www.flickr.com/photos/beto_frota/3232254956
I’m not going to go into anything in too much detail, however I’ve included links within the slides where necessary so
you can get further information.

The slides are on my Slideshare account. I’ll put the link up at the end.
WEB APP PITFALLS
HARDWARE LIMITATIONS
                                   Memory, GPU, battery…




One of the most obvious pitfalls is around device hardware limitations, things like memory, and GPU.

Now there aren’t any silver-bullet solutions here to improve memory consumption and GPU usage, but there are
certainly ways to improve things in general.

For example, to make better use of limited hardware you could offload graphics to the GPU by using hardware-
accelerated CSS calls instead of doing everything with the CPU.

There are also ways to save battery. For example, when animating you should use requestAnimationFrame instead of
setTimeout as it puts the browser in control of when to draw things. If the application is in the background then
nothing will draw, saving battery.

You can also use things like the Battery API to intelligently degrade functionality as energy levels decrease.
DIFFERING BROWSER SUPPORT
                             WebAPIs, manifests, tooling…




Another obvious pitfall is around the huge differences between supported features in browsers.

Some prime examples at the moment include various WebAPIs not being supported in all browsers, and application
manifests between different browsers being formatted slightly differently.

I won’t go into any more detail about specifics, but what I will say is that it’s always a good idea to use shims and
feature detection when using functionality that may not be fully supported everywhere.
CHANGING SPECS
                                     Some APIs are in flux




Related to browser support is changing API specifications and implementation.

This is how Web technologies naturally develop and usually doesn’t result in anything catastrophic. However, it’s
always a good idea to keep an eye on APIs and technologies that are known to be in a non-finalised state – they
might change.

One recent example is WebSockets, around a year ago the WebSockets spec changed in a way that broke all existing
implementations. It was necessary, but it meant that developers who didn’t update their code had their apps
suddenly break when the browsers dropped support for the older WebSockets APIs.
DIFFERING PERFORMANCE
                  Similar spec hardware, different results




If you are developing anything that is vaguely intensive, like a game, you’ll have noticed massive differences in
performance on mobile, even between browsers on the same device.

In short, performance on similar mobile devices should not be assumed and instead should be tested and expected
to differ.
Average         Average           Lowest          Highest
                     Device
                                          Min FPS         Max FPS            FPS              FPS

              Otoro (Fx OS)                     40.40           49.80            18.00            61.00

              Otoro (Fennec)                    19.38           31.75             4.00            46.00

              SGS2 (Fx OS)                      46.11           57.78            20.00            71.00

              SGS2 (Fennec)                     29.38           39.63             8.00            52.00

              Unagi (Fx OS)                     39.80           46.60            20.00            59.00

              Nexus S (Fennec)                  15.88           27.63             4.00            40.00

              Nexus 7 (Fennec)                  27.11           33.89             4.00            50.00

              Nexus (Fennec)                    25.75           34.13             6.00            46.00




I’ve been doing a lot of research in this area with games on Firefox OS and Fennec and it’s shown interesting results.

What we’re seeing is that the frame-rate on similarly-specced devices can differ by a significant amount when playing
the same game in the same browser environment.

As a side-note; what we’re also seeing is that frame-rates are significantly better on Firefox OS than Fennec on an
identical device – often in the range of 1.3 to 1.5x better.
VIEWABLE SOURCE
                              Part of what makes the Web




A controversial potential pitfall is that of Web apps having an openly viewable source.

Viewable source on its own isn’t necessarily a pitfall, as it’s just the way the Web works, but what if you need to add
some element of protection to your app assets?

There are some ways to implement types of ‘protection’, like compressing and obfuscating code, but they aren’t
fool-proof.

One common technique, at least in games, is to defer protected logic to the server while embracing the openness of
code on the client.
APP MANIFEST QUIRKS
                              Simple once you know how




When using application manifests there are a few things to bear in mind.

https://developer.mozilla.org/en-US/docs/Apps/Manifest
MIME-TYPE REQUIREMENT
                   application/x-web-app-manifest+json




App manifest files must be served with the application/x-web-app-manifest+json MIME-type for them to be
recognised by the browser.

We’ve worked with GitHub on this and application manifests hosted using GitHub pages are automatically served with
the correct type.

https://developer.mozilla.org/en-US/docs/HTML/Using_the_application_cache#Structure_of_a_cache_manifest_file
SAME ORIGIN POLICY
            Manifest and app served from same domain




Application manifests must be served from the same origin as the application they describe.
APPCACHE IS…
              Not quite as bad as some make it out to be




AppCache is another technology that gets quite a bad press around perceived issues and difficulties.

I don’t believe it’s quite as bad as we make out.
MIME-TYPE REQUIREMENT
                                     text/cache-manifest




One of the basic things that can trip people up is the MIME-type requirement for AppCache manifest files.

The manifest can have any extension but must be served with the text/cache-manifest MIME-type for the browser to
recognise it.
Jake Archibald’s talk on AppCache quirks and workarounds is a fantastic resource on what to look out for with the
technology.

The following are a selection of his key observations…

http://www.alistapart.com/articles/application-cache-is-a-douchebag/
#1
          FILES ALWAYS COME FROM THE
             APPCACHE, EVEN IF YOU’RE
                    ONLINE


Resources in the AppCache will always be pulled from the cache, even if you’re online.

When the cached resources are updated AppCache will fire an updateready event, though you’ll need to refresh the
page to see them.

The updateready event is where you’ll listen if you want to prompt the user to reload the page when updates are
ready, otherwise they’ll naturally get the latest resources the next time they view your app, or the next time they
navigate around your app.
#2
       THE APPCACHE ONLY UPDATES IF
       THE CONTENT OF THE MANIFEST
            ITSELF HAS CHANGED


Although AppCache lets you know when updates are ready, these updates may not work in the way you’re expecting.

What happens is that the AppCache won’t update unless the AppCache manifest itself is updated.

The reasoning for this is that the browser would otherwise have no idea which files needed updating and would have
to check every single file referenced within the manifest.

The most common way to force an update to the manifest is by using a commented version number or timestamp
every time you change one of the files referenced in the AppCache.
CACHE MANIFEST
# 2012-12-05:v10

# Explicitly cached resources
CACHE:
appleicon.png
classlib.js
…

# Resources that require the user to be online.
NETWORK:
*

# Fallbacks if files cannot be found
FALLBACK:
#3
     THE APPCACHE IS AN ADDITIONAL
     CACHE, NOT AN ALTERNATIVE ONE




When the browser updates the AppCache it requests resources as it normally would, meaning that it obeys standard
cache headers.

One way this can catch you out is if you don’t serve cache headers with your resources then the browser may ‘guess’
that the resource doesn’t need to be updated and won’t request it.

Jake’s recommended workaround for this is to serve cache headers with your resources, perhaps even setting them
as no-cache if you’re testing a lot.
#4
           NEVER EVER EVER FAR-FUTURE
              CACHE THE MANIFEST




One interesting quirk with AppCache is that you can get yourself into a lot of trouble if you mess around with the
caching of the manifest itself.

For example, if you set a cache header on the manifest file for it not to update in a long time, then change the URL of
the manifest in your HTML document to try and force an update, then nothing will update. Ever.

The reason for this is that the user will be seeing the cached HTML document which is referencing the old manifest
file, which is exactly the same as it was last time it checked, so nothing changes.

How to avoid this? Don’t rename the manifest file unless you know what you’re doing.
#5
         NON-CACHED RESOURCES WILL
         NOT LOAD ON A CACHED PAGE




By default, any resources that you don’t reference within the AppCache manifest won’t be displayed. This is the
default behaviour of AppCache.

To work around this, you can add a NETWORK section to the manifest with a * wildcard. This will make sure anything
not cached will be requested from the network if online.
CACHE MANIFEST
# 2012-12-05:v10

# Explicitly cached resources
CACHE:
appleicon.png
classlib.js
…

# Resources that require the user to be online.
NETWORK:
*

# Fallbacks if files cannot be found
FALLBACK:
“I’M NOT SAYING THAT
         APPLICATIONCACHE SHOULD BE
            AVOIDED, IT’S EXTREMELY
                    USEFUL.”
                                                                                   Jake Archibald




You may be under the assumption that AppCache isn’t ready, or is too quirky for prime-time.

I think Jake’s final words on the matter sum up how you should view his criticism of the technology.

His main point is that you should be aware of the quirks and limitations of AppCache so you can use it to it’s full
potential.
AppCache Facts is another great resource on the truths behind AppCache.

http://appcachefacts.info/
WEB APP HELPERS
CROSS-PLATFORM SUPPORT
                           Taking the sting out of things




General cross-platform support
Modernizr for feature detection

http://modernizr.com
Can I Use? for compatibility charts

http://caniuse.com
Mobile HTML5 for mobile-specific compatibility charts

http://mobilehtml5.org
WebSockets with Socket.io

Automatically falls back to long-polling if necessary.

http://socket.io/
Lawnchair for reliable local storage

Automatically selects the best storage option for each platform.

http://brian.io/lawnchair/
APPCACHE GENERATORS
                      Taking the pain out of manifests




AppCache generators
Manifested online generator

http://manifested.dregsoft.com
manifestR bookmarklet

http://westciv.com/tools/manifestR/
Command-line approach using PhantomJS and confess.js

https://github.com/jamesgpearce/confess
My own online AppCache generator built using confess.js on the server

http://appcache.rawkes.com
TESTING APPCACHE
                   Being sure that it actually works




Testing AppCache
Chrome appcache-internals page

chrome://appcache-internals
Firefox about:cache

Click on “Offline cache device” when you reach the about:cache page
Charles proxy

http://www.charlesproxy.com/
Chrome developer tools network pane

Look for ‘(from cache)’ in the size column
Firefox developer tools ‘Net’ logging

Simply doesn’t display resources that have been loaded from the cache

This also works with remote debugging so you can see network logs from a Firefox OS or Fennec device…

https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Debugging_on_Boot_to_Gecko/Setting_up
UI BUILDING BLOCKS
  Keeping a consistent style
Gaia UI Building Blocks

https://github.com/mozilla-b2g/Gaia-UI-Building-Blocks
Twitter Bootstrap

http://twitter.github.com/bootstrap/
jQuery Mobile

http://jquerymobile.com/
EASING APP DEVELOPMENT
    Templates and frameworks
Mortar is the recommend set of Web app templates for Firefox OS

https://github.com/mozilla/mortar
BUILD TOOLS
Automating common tasks
Volo

https://github.com/volojs/volo
Grunt

http://gruntjs.com/
HTML5 Boilerplate build script (using Grunt)

https://github.com/h5bp/node-build-script
PERFORMANCE
Tools for analysing and optimisation
YSlow!

http://developer.yahoo.com/yslow/
PageSpeed

https://developers.google.com/speed/pagespeed/
Smush.it

http://www.smushit.com/ysmush.it/
Pngcrush

http://pmt.sourceforge.net/pngcrush/
YUI Compressor

http://developer.yahoo.com/yui/compressor/
http://refresh-sf.com/yui/
UglifyJS

http://marijnhaverbeke.nl/uglifyjs
FIREFOX OS SIMULATOR
                       Perfect for testing Firefox OS apps




Firefox OS Simulator

https://addons.mozilla.org/en-US/firefox/addon/firefox-os-simulator/
FURTHER RESOURCES
Apps area on MDN

https://developer.mozilla.org/en-US/docs/Apps
Firefox Marketplace Developer Hub

https://marketplace.firefox.com/developers/
HTML5 Rocks article on mobile performance

http://www.html5rocks.com/en/mobile/optimization-and-performance/
Sam Dutton’s talk on mobile Web app performance and optimisation

http://www.samdutton.com/velocity2012/
Tasneem Sayeed’s talk on improving mobile Web app experience

http://www.slideshare.net/tasneemsayeed/developer-pitfalls-strategies-for-improving-mobile-web-developer-
experience
Mobile Web app best practices from the W3C

http://www.w3.org/TR/mwabp/
@ROBHAWKES

SLIDESHARE.NET/ROBHAWKES

More Related Content

Viewers also liked

Session3 pl online_course_22_september2011
Session3  pl online_course_22_september2011Session3  pl online_course_22_september2011
Session3 pl online_course_22_september2011LeslieOflahavan
 
041018 It Committee Bog Onlyejewish
041018 It Committee Bog Onlyejewish041018 It Committee Bog Onlyejewish
041018 It Committee Bog OnlyejewishDov Winer
 
051206 Seminar Advanced Technologiest For Archives
051206 Seminar Advanced Technologiest For Archives051206 Seminar Advanced Technologiest For Archives
051206 Seminar Advanced Technologiest For ArchivesDov Winer
 
MozTW Off-Line Paper at 2009
MozTW Off-Line Paper at 2009MozTW Off-Line Paper at 2009
MozTW Off-Line Paper at 2009Toomore
 
Session1 pl online_course_8_september2011
Session1  pl online_course_8_september2011Session1  pl online_course_8_september2011
Session1 pl online_course_8_september2011LeslieOflahavan
 
Calculating building heights using a phone camera
Calculating building heights using a phone cameraCalculating building heights using a phone camera
Calculating building heights using a phone cameraRobin Hawkes
 
Как мобильный интернет изменит электронную коммерцию
Как мобильный интернет изменит электронную коммерциюКак мобильный интернет изменит электронную коммерцию
Как мобильный интернет изменит электронную коммерциюOleg Nozhichkin
 
Majalah INFO-UFO no 01
Majalah INFO-UFO no 01Majalah INFO-UFO no 01
Majalah INFO-UFO no 01Nur Agustinus
 
E write - loc advanced writing for the web 23 may2011
E write - loc advanced writing for the web 23 may2011E write - loc advanced writing for the web 23 may2011
E write - loc advanced writing for the web 23 may2011LeslieOflahavan
 
Cahokia:Collapsing Inot Thin Air
Cahokia:Collapsing Inot Thin AirCahokia:Collapsing Inot Thin Air
Cahokia:Collapsing Inot Thin Airkatmoore
 
E write - ywca boston how to publish e newsletter that pays you back - 8july2013
E write - ywca boston how to publish e newsletter that pays you back - 8july2013E write - ywca boston how to publish e newsletter that pays you back - 8july2013
E write - ywca boston how to publish e newsletter that pays you back - 8july2013LeslieOflahavan
 
Wilfreda - Oscar
Wilfreda - OscarWilfreda - Oscar
Wilfreda - Oscarmeroga
 
Semibase Portfolio
Semibase PortfolioSemibase Portfolio
Semibase Portfoliosemibase
 
University of The Future 2012
University of The Future 2012University of The Future 2012
University of The Future 2012Nur Agustinus
 
Samsung YP-U4 Bilder
Samsung YP-U4 BilderSamsung YP-U4 Bilder
Samsung YP-U4 Bilderjulia135
 
Usp pundit 2013
Usp pundit 2013Usp pundit 2013
Usp pundit 2013Dov Winer
 

Viewers also liked (20)

Session3 pl online_course_22_september2011
Session3  pl online_course_22_september2011Session3  pl online_course_22_september2011
Session3 pl online_course_22_september2011
 
041018 It Committee Bog Onlyejewish
041018 It Committee Bog Onlyejewish041018 It Committee Bog Onlyejewish
041018 It Committee Bog Onlyejewish
 
051206 Seminar Advanced Technologiest For Archives
051206 Seminar Advanced Technologiest For Archives051206 Seminar Advanced Technologiest For Archives
051206 Seminar Advanced Technologiest For Archives
 
MozTW Off-Line Paper at 2009
MozTW Off-Line Paper at 2009MozTW Off-Line Paper at 2009
MozTW Off-Line Paper at 2009
 
Profil Ringkas INSPIRASI BAKAT
Profil Ringkas INSPIRASI BAKATProfil Ringkas INSPIRASI BAKAT
Profil Ringkas INSPIRASI BAKAT
 
Session1 pl online_course_8_september2011
Session1  pl online_course_8_september2011Session1  pl online_course_8_september2011
Session1 pl online_course_8_september2011
 
That's not what he said!
That's not what he said!That's not what he said!
That's not what he said!
 
Calculating building heights using a phone camera
Calculating building heights using a phone cameraCalculating building heights using a phone camera
Calculating building heights using a phone camera
 
Как мобильный интернет изменит электронную коммерцию
Как мобильный интернет изменит электронную коммерциюКак мобильный интернет изменит электронную коммерцию
Как мобильный интернет изменит электронную коммерцию
 
Majalah INFO-UFO no 01
Majalah INFO-UFO no 01Majalah INFO-UFO no 01
Majalah INFO-UFO no 01
 
E write - loc advanced writing for the web 23 may2011
E write - loc advanced writing for the web 23 may2011E write - loc advanced writing for the web 23 may2011
E write - loc advanced writing for the web 23 may2011
 
Cahokia:Collapsing Inot Thin Air
Cahokia:Collapsing Inot Thin AirCahokia:Collapsing Inot Thin Air
Cahokia:Collapsing Inot Thin Air
 
E write - ywca boston how to publish e newsletter that pays you back - 8july2013
E write - ywca boston how to publish e newsletter that pays you back - 8july2013E write - ywca boston how to publish e newsletter that pays you back - 8july2013
E write - ywca boston how to publish e newsletter that pays you back - 8july2013
 
Wilfreda - Oscar
Wilfreda - OscarWilfreda - Oscar
Wilfreda - Oscar
 
Semibase Portfolio
Semibase PortfolioSemibase Portfolio
Semibase Portfolio
 
University of The Future 2012
University of The Future 2012University of The Future 2012
University of The Future 2012
 
The Prayer +
The Prayer +The Prayer +
The Prayer +
 
Rencana Pembentukan Program Studi Ekonomi ITB
Rencana Pembentukan Program Studi Ekonomi ITBRencana Pembentukan Program Studi Ekonomi ITB
Rencana Pembentukan Program Studi Ekonomi ITB
 
Samsung YP-U4 Bilder
Samsung YP-U4 BilderSamsung YP-U4 Bilder
Samsung YP-U4 Bilder
 
Usp pundit 2013
Usp pundit 2013Usp pundit 2013
Usp pundit 2013
 

Similar to Mobile App Development - Pitfalls & Helpers

Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applicationsFDConf
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Jan Jongboom
 
<img src="../i/r_14.png" />
<img src="../i/r_14.png" /><img src="../i/r_14.png" />
<img src="../i/r_14.png" />tutorialsruby
 
wexarts.org iPhone Project: Developer Documentation
wexarts.org iPhone Project: Developer Documentationwexarts.org iPhone Project: Developer Documentation
wexarts.org iPhone Project: Developer Documentationtutorialsruby
 
Aspnet2.0 Introduction
Aspnet2.0 IntroductionAspnet2.0 Introduction
Aspnet2.0 IntroductionChanHan Hy
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by CitytechRitwik Das
 
What's New in AppFuse 2.0
What's New in AppFuse 2.0What's New in AppFuse 2.0
What's New in AppFuse 2.0Matt Raible
 
AWS Tech Summit - Berlin 2011 - Running Java Applications on AWS
AWS Tech Summit - Berlin 2011 - Running Java Applications on AWSAWS Tech Summit - Berlin 2011 - Running Java Applications on AWS
AWS Tech Summit - Berlin 2011 - Running Java Applications on AWSAmazon Web Services
 
Web application penetration testing lab setup guide
Web application penetration testing lab setup guideWeb application penetration testing lab setup guide
Web application penetration testing lab setup guideSudhanshu Chauhan
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...Paul Jensen
 
PWA basics for developers
PWA basics for developersPWA basics for developers
PWA basics for developersFilip Rakowski
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakayaMbakaya Kwatukha
 
System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web ApplicationMichael Choi
 
An end-to-end experience of Windows Phone 7 development (Part 2)
An end-to-end experience of Windows Phone 7 development (Part 2)An end-to-end experience of Windows Phone 7 development (Part 2)
An end-to-end experience of Windows Phone 7 development (Part 2)rudigrobler
 
TiConf NYC - Documenting Your Titanium Applications
TiConf NYC - Documenting Your Titanium ApplicationsTiConf NYC - Documenting Your Titanium Applications
TiConf NYC - Documenting Your Titanium ApplicationsJamil Spain
 
Documenting apps ti confnyc
Documenting apps   ti confnycDocumenting apps   ti confnyc
Documenting apps ti confnycJamil Spain
 
Anatomy of an APS 2 appication
Anatomy of an APS 2 appicationAnatomy of an APS 2 appication
Anatomy of an APS 2 appicationMarcello Teodori
 

Similar to Mobile App Development - Pitfalls & Helpers (20)

Webapi
WebapiWebapi
Webapi
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applications
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014
 
<img src="../i/r_14.png" />
<img src="../i/r_14.png" /><img src="../i/r_14.png" />
<img src="../i/r_14.png" />
 
wexarts.org iPhone Project: Developer Documentation
wexarts.org iPhone Project: Developer Documentationwexarts.org iPhone Project: Developer Documentation
wexarts.org iPhone Project: Developer Documentation
 
Aspnet2.0 Introduction
Aspnet2.0 IntroductionAspnet2.0 Introduction
Aspnet2.0 Introduction
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
 
What's New in AppFuse 2.0
What's New in AppFuse 2.0What's New in AppFuse 2.0
What's New in AppFuse 2.0
 
AWS Tech Summit - Berlin 2011 - Running Java Applications on AWS
AWS Tech Summit - Berlin 2011 - Running Java Applications on AWSAWS Tech Summit - Berlin 2011 - Running Java Applications on AWS
AWS Tech Summit - Berlin 2011 - Running Java Applications on AWS
 
Web application penetration testing lab setup guide
Web application penetration testing lab setup guideWeb application penetration testing lab setup guide
Web application penetration testing lab setup guide
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
 
PWA basics for developers
PWA basics for developersPWA basics for developers
PWA basics for developers
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
Cakephp manual-11
Cakephp manual-11Cakephp manual-11
Cakephp manual-11
 
System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web Application
 
An end-to-end experience of Windows Phone 7 development (Part 2)
An end-to-end experience of Windows Phone 7 development (Part 2)An end-to-end experience of Windows Phone 7 development (Part 2)
An end-to-end experience of Windows Phone 7 development (Part 2)
 
TiConf NYC - Documenting Your Titanium Applications
TiConf NYC - Documenting Your Titanium ApplicationsTiConf NYC - Documenting Your Titanium Applications
TiConf NYC - Documenting Your Titanium Applications
 
Documenting apps ti confnyc
Documenting apps   ti confnycDocumenting apps   ti confnyc
Documenting apps ti confnyc
 
Flex and Java
Flex and JavaFlex and Java
Flex and Java
 
Anatomy of an APS 2 appication
Anatomy of an APS 2 appicationAnatomy of an APS 2 appication
Anatomy of an APS 2 appication
 

More from Robin Hawkes

ViziCities - Lessons Learnt Visualising Real-world Cities in 3D
ViziCities - Lessons Learnt Visualising Real-world Cities in 3DViziCities - Lessons Learnt Visualising Real-world Cities in 3D
ViziCities - Lessons Learnt Visualising Real-world Cities in 3DRobin Hawkes
 
Understanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationUnderstanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationRobin Hawkes
 
WebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big DataWebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big DataRobin Hawkes
 
Understanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationUnderstanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationRobin Hawkes
 
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGL
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGLViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGL
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGLRobin Hawkes
 
Beautiful Data Visualisation & D3
Beautiful Data Visualisation & D3Beautiful Data Visualisation & D3
Beautiful Data Visualisation & D3Robin Hawkes
 
ViziCities: Making SimCity for the Real World
ViziCities: Making SimCity for the Real WorldViziCities: Making SimCity for the Real World
ViziCities: Making SimCity for the Real WorldRobin Hawkes
 
The State of WebRTC
The State of WebRTCThe State of WebRTC
The State of WebRTCRobin Hawkes
 
Bringing Cities to Life Using Big Data & WebGL
Bringing Cities to Life Using Big Data & WebGLBringing Cities to Life Using Big Data & WebGL
Bringing Cities to Life Using Big Data & WebGLRobin Hawkes
 
Boot to Gecko – The Web as a Platform
Boot to Gecko – The Web as a PlatformBoot to Gecko – The Web as a Platform
Boot to Gecko – The Web as a PlatformRobin Hawkes
 
Mozilla Firefox: Present and Future - Fluent JS
Mozilla Firefox: Present and Future - Fluent JSMozilla Firefox: Present and Future - Fluent JS
Mozilla Firefox: Present and Future - Fluent JSRobin Hawkes
 
The State of HTML5 Games - Fluent JS
The State of HTML5 Games - Fluent JSThe State of HTML5 Games - Fluent JS
The State of HTML5 Games - Fluent JSRobin Hawkes
 
HTML5 Technologies for Game Development - Web Directions Code
HTML5 Technologies for Game Development - Web Directions CodeHTML5 Technologies for Game Development - Web Directions Code
HTML5 Technologies for Game Development - Web Directions CodeRobin Hawkes
 
MelbJS - Inside Rawkets
MelbJS - Inside RawketsMelbJS - Inside Rawkets
MelbJS - Inside RawketsRobin Hawkes
 
Melbourne Geek Night - Boot to Gecko – The Web as a Platform
Melbourne Geek Night - Boot to Gecko – The Web as a PlatformMelbourne Geek Night - Boot to Gecko – The Web as a Platform
Melbourne Geek Night - Boot to Gecko – The Web as a PlatformRobin Hawkes
 
Hacking with B2G – Web Apps and Customisation
Hacking with B2G – Web Apps and CustomisationHacking with B2G – Web Apps and Customisation
Hacking with B2G – Web Apps and CustomisationRobin Hawkes
 
MDN Hackday London - Open Web Games with HTML5 & JavaScript
MDN Hackday London - Open Web Games with HTML5 & JavaScriptMDN Hackday London - Open Web Games with HTML5 & JavaScript
MDN Hackday London - Open Web Games with HTML5 & JavaScriptRobin Hawkes
 
MDN Hackday London - Boot to Gecko: The Future of Mobile
MDN Hackday London - Boot to Gecko: The Future of MobileMDN Hackday London - Boot to Gecko: The Future of Mobile
MDN Hackday London - Boot to Gecko: The Future of MobileRobin Hawkes
 
Geek Meet - Boot to Gecko: The Future of Mobile?
Geek Meet - Boot to Gecko: The Future of Mobile?Geek Meet - Boot to Gecko: The Future of Mobile?
Geek Meet - Boot to Gecko: The Future of Mobile?Robin Hawkes
 
HTML5 Games - Not Just for Gamers
HTML5 Games - Not Just for GamersHTML5 Games - Not Just for Gamers
HTML5 Games - Not Just for GamersRobin Hawkes
 

More from Robin Hawkes (20)

ViziCities - Lessons Learnt Visualising Real-world Cities in 3D
ViziCities - Lessons Learnt Visualising Real-world Cities in 3DViziCities - Lessons Learnt Visualising Real-world Cities in 3D
ViziCities - Lessons Learnt Visualising Real-world Cities in 3D
 
Understanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationUnderstanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisation
 
WebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big DataWebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big Data
 
Understanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationUnderstanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisation
 
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGL
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGLViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGL
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGL
 
Beautiful Data Visualisation & D3
Beautiful Data Visualisation & D3Beautiful Data Visualisation & D3
Beautiful Data Visualisation & D3
 
ViziCities: Making SimCity for the Real World
ViziCities: Making SimCity for the Real WorldViziCities: Making SimCity for the Real World
ViziCities: Making SimCity for the Real World
 
The State of WebRTC
The State of WebRTCThe State of WebRTC
The State of WebRTC
 
Bringing Cities to Life Using Big Data & WebGL
Bringing Cities to Life Using Big Data & WebGLBringing Cities to Life Using Big Data & WebGL
Bringing Cities to Life Using Big Data & WebGL
 
Boot to Gecko – The Web as a Platform
Boot to Gecko – The Web as a PlatformBoot to Gecko – The Web as a Platform
Boot to Gecko – The Web as a Platform
 
Mozilla Firefox: Present and Future - Fluent JS
Mozilla Firefox: Present and Future - Fluent JSMozilla Firefox: Present and Future - Fluent JS
Mozilla Firefox: Present and Future - Fluent JS
 
The State of HTML5 Games - Fluent JS
The State of HTML5 Games - Fluent JSThe State of HTML5 Games - Fluent JS
The State of HTML5 Games - Fluent JS
 
HTML5 Technologies for Game Development - Web Directions Code
HTML5 Technologies for Game Development - Web Directions CodeHTML5 Technologies for Game Development - Web Directions Code
HTML5 Technologies for Game Development - Web Directions Code
 
MelbJS - Inside Rawkets
MelbJS - Inside RawketsMelbJS - Inside Rawkets
MelbJS - Inside Rawkets
 
Melbourne Geek Night - Boot to Gecko – The Web as a Platform
Melbourne Geek Night - Boot to Gecko – The Web as a PlatformMelbourne Geek Night - Boot to Gecko – The Web as a Platform
Melbourne Geek Night - Boot to Gecko – The Web as a Platform
 
Hacking with B2G – Web Apps and Customisation
Hacking with B2G – Web Apps and CustomisationHacking with B2G – Web Apps and Customisation
Hacking with B2G – Web Apps and Customisation
 
MDN Hackday London - Open Web Games with HTML5 & JavaScript
MDN Hackday London - Open Web Games with HTML5 & JavaScriptMDN Hackday London - Open Web Games with HTML5 & JavaScript
MDN Hackday London - Open Web Games with HTML5 & JavaScript
 
MDN Hackday London - Boot to Gecko: The Future of Mobile
MDN Hackday London - Boot to Gecko: The Future of MobileMDN Hackday London - Boot to Gecko: The Future of Mobile
MDN Hackday London - Boot to Gecko: The Future of Mobile
 
Geek Meet - Boot to Gecko: The Future of Mobile?
Geek Meet - Boot to Gecko: The Future of Mobile?Geek Meet - Boot to Gecko: The Future of Mobile?
Geek Meet - Boot to Gecko: The Future of Mobile?
 
HTML5 Games - Not Just for Gamers
HTML5 Games - Not Just for GamersHTML5 Games - Not Just for Gamers
HTML5 Games - Not Just for Gamers
 

Recently uploaded

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Mobile App Development - Pitfalls & Helpers

  • 1. PITFALLS AND HELPERS Mobile HTML5 Applications
  • 2. My name is Rob Hawkes, I’m one of the Technical Evangelists at Mozilla. My focus is games, most recently around Firefox OS and mobile.
  • 3. I’m also British, if you hadn’t already guessed. Photo: http://www.flickr.com/photos/beto_frota/3232254956
  • 4. I’m not going to go into anything in too much detail, however I’ve included links within the slides where necessary so you can get further information. The slides are on my Slideshare account. I’ll put the link up at the end.
  • 6. HARDWARE LIMITATIONS Memory, GPU, battery… One of the most obvious pitfalls is around device hardware limitations, things like memory, and GPU. Now there aren’t any silver-bullet solutions here to improve memory consumption and GPU usage, but there are certainly ways to improve things in general. For example, to make better use of limited hardware you could offload graphics to the GPU by using hardware- accelerated CSS calls instead of doing everything with the CPU. There are also ways to save battery. For example, when animating you should use requestAnimationFrame instead of setTimeout as it puts the browser in control of when to draw things. If the application is in the background then nothing will draw, saving battery. You can also use things like the Battery API to intelligently degrade functionality as energy levels decrease.
  • 7. DIFFERING BROWSER SUPPORT WebAPIs, manifests, tooling… Another obvious pitfall is around the huge differences between supported features in browsers. Some prime examples at the moment include various WebAPIs not being supported in all browsers, and application manifests between different browsers being formatted slightly differently. I won’t go into any more detail about specifics, but what I will say is that it’s always a good idea to use shims and feature detection when using functionality that may not be fully supported everywhere.
  • 8. CHANGING SPECS Some APIs are in flux Related to browser support is changing API specifications and implementation. This is how Web technologies naturally develop and usually doesn’t result in anything catastrophic. However, it’s always a good idea to keep an eye on APIs and technologies that are known to be in a non-finalised state – they might change. One recent example is WebSockets, around a year ago the WebSockets spec changed in a way that broke all existing implementations. It was necessary, but it meant that developers who didn’t update their code had their apps suddenly break when the browsers dropped support for the older WebSockets APIs.
  • 9. DIFFERING PERFORMANCE Similar spec hardware, different results If you are developing anything that is vaguely intensive, like a game, you’ll have noticed massive differences in performance on mobile, even between browsers on the same device. In short, performance on similar mobile devices should not be assumed and instead should be tested and expected to differ.
  • 10. Average Average Lowest Highest Device Min FPS Max FPS FPS FPS Otoro (Fx OS) 40.40 49.80 18.00 61.00 Otoro (Fennec) 19.38 31.75 4.00 46.00 SGS2 (Fx OS) 46.11 57.78 20.00 71.00 SGS2 (Fennec) 29.38 39.63 8.00 52.00 Unagi (Fx OS) 39.80 46.60 20.00 59.00 Nexus S (Fennec) 15.88 27.63 4.00 40.00 Nexus 7 (Fennec) 27.11 33.89 4.00 50.00 Nexus (Fennec) 25.75 34.13 6.00 46.00 I’ve been doing a lot of research in this area with games on Firefox OS and Fennec and it’s shown interesting results. What we’re seeing is that the frame-rate on similarly-specced devices can differ by a significant amount when playing the same game in the same browser environment. As a side-note; what we’re also seeing is that frame-rates are significantly better on Firefox OS than Fennec on an identical device – often in the range of 1.3 to 1.5x better.
  • 11. VIEWABLE SOURCE Part of what makes the Web A controversial potential pitfall is that of Web apps having an openly viewable source. Viewable source on its own isn’t necessarily a pitfall, as it’s just the way the Web works, but what if you need to add some element of protection to your app assets? There are some ways to implement types of ‘protection’, like compressing and obfuscating code, but they aren’t fool-proof. One common technique, at least in games, is to defer protected logic to the server while embracing the openness of code on the client.
  • 12. APP MANIFEST QUIRKS Simple once you know how When using application manifests there are a few things to bear in mind. https://developer.mozilla.org/en-US/docs/Apps/Manifest
  • 13. MIME-TYPE REQUIREMENT application/x-web-app-manifest+json App manifest files must be served with the application/x-web-app-manifest+json MIME-type for them to be recognised by the browser. We’ve worked with GitHub on this and application manifests hosted using GitHub pages are automatically served with the correct type. https://developer.mozilla.org/en-US/docs/HTML/Using_the_application_cache#Structure_of_a_cache_manifest_file
  • 14. SAME ORIGIN POLICY Manifest and app served from same domain Application manifests must be served from the same origin as the application they describe.
  • 15. APPCACHE IS… Not quite as bad as some make it out to be AppCache is another technology that gets quite a bad press around perceived issues and difficulties. I don’t believe it’s quite as bad as we make out.
  • 16. MIME-TYPE REQUIREMENT text/cache-manifest One of the basic things that can trip people up is the MIME-type requirement for AppCache manifest files. The manifest can have any extension but must be served with the text/cache-manifest MIME-type for the browser to recognise it.
  • 17. Jake Archibald’s talk on AppCache quirks and workarounds is a fantastic resource on what to look out for with the technology. The following are a selection of his key observations… http://www.alistapart.com/articles/application-cache-is-a-douchebag/
  • 18. #1 FILES ALWAYS COME FROM THE APPCACHE, EVEN IF YOU’RE ONLINE Resources in the AppCache will always be pulled from the cache, even if you’re online. When the cached resources are updated AppCache will fire an updateready event, though you’ll need to refresh the page to see them. The updateready event is where you’ll listen if you want to prompt the user to reload the page when updates are ready, otherwise they’ll naturally get the latest resources the next time they view your app, or the next time they navigate around your app.
  • 19. #2 THE APPCACHE ONLY UPDATES IF THE CONTENT OF THE MANIFEST ITSELF HAS CHANGED Although AppCache lets you know when updates are ready, these updates may not work in the way you’re expecting. What happens is that the AppCache won’t update unless the AppCache manifest itself is updated. The reasoning for this is that the browser would otherwise have no idea which files needed updating and would have to check every single file referenced within the manifest. The most common way to force an update to the manifest is by using a commented version number or timestamp every time you change one of the files referenced in the AppCache.
  • 20. CACHE MANIFEST # 2012-12-05:v10 # Explicitly cached resources CACHE: appleicon.png classlib.js … # Resources that require the user to be online. NETWORK: * # Fallbacks if files cannot be found FALLBACK:
  • 21. #3 THE APPCACHE IS AN ADDITIONAL CACHE, NOT AN ALTERNATIVE ONE When the browser updates the AppCache it requests resources as it normally would, meaning that it obeys standard cache headers. One way this can catch you out is if you don’t serve cache headers with your resources then the browser may ‘guess’ that the resource doesn’t need to be updated and won’t request it. Jake’s recommended workaround for this is to serve cache headers with your resources, perhaps even setting them as no-cache if you’re testing a lot.
  • 22. #4 NEVER EVER EVER FAR-FUTURE CACHE THE MANIFEST One interesting quirk with AppCache is that you can get yourself into a lot of trouble if you mess around with the caching of the manifest itself. For example, if you set a cache header on the manifest file for it not to update in a long time, then change the URL of the manifest in your HTML document to try and force an update, then nothing will update. Ever. The reason for this is that the user will be seeing the cached HTML document which is referencing the old manifest file, which is exactly the same as it was last time it checked, so nothing changes. How to avoid this? Don’t rename the manifest file unless you know what you’re doing.
  • 23. #5 NON-CACHED RESOURCES WILL NOT LOAD ON A CACHED PAGE By default, any resources that you don’t reference within the AppCache manifest won’t be displayed. This is the default behaviour of AppCache. To work around this, you can add a NETWORK section to the manifest with a * wildcard. This will make sure anything not cached will be requested from the network if online.
  • 24. CACHE MANIFEST # 2012-12-05:v10 # Explicitly cached resources CACHE: appleicon.png classlib.js … # Resources that require the user to be online. NETWORK: * # Fallbacks if files cannot be found FALLBACK:
  • 25. “I’M NOT SAYING THAT APPLICATIONCACHE SHOULD BE AVOIDED, IT’S EXTREMELY USEFUL.” Jake Archibald You may be under the assumption that AppCache isn’t ready, or is too quirky for prime-time. I think Jake’s final words on the matter sum up how you should view his criticism of the technology. His main point is that you should be aware of the quirks and limitations of AppCache so you can use it to it’s full potential.
  • 26. AppCache Facts is another great resource on the truths behind AppCache. http://appcachefacts.info/
  • 28. CROSS-PLATFORM SUPPORT Taking the sting out of things General cross-platform support
  • 29. Modernizr for feature detection http://modernizr.com
  • 30. Can I Use? for compatibility charts http://caniuse.com
  • 31. Mobile HTML5 for mobile-specific compatibility charts http://mobilehtml5.org
  • 32. WebSockets with Socket.io Automatically falls back to long-polling if necessary. http://socket.io/
  • 33. Lawnchair for reliable local storage Automatically selects the best storage option for each platform. http://brian.io/lawnchair/
  • 34. APPCACHE GENERATORS Taking the pain out of manifests AppCache generators
  • 37. Command-line approach using PhantomJS and confess.js https://github.com/jamesgpearce/confess
  • 38. My own online AppCache generator built using confess.js on the server http://appcache.rawkes.com
  • 39. TESTING APPCACHE Being sure that it actually works Testing AppCache
  • 41. Firefox about:cache Click on “Offline cache device” when you reach the about:cache page
  • 43. Chrome developer tools network pane Look for ‘(from cache)’ in the size column
  • 44. Firefox developer tools ‘Net’ logging Simply doesn’t display resources that have been loaded from the cache This also works with remote debugging so you can see network logs from a Firefox OS or Fennec device… https://developer.mozilla.org/en-US/docs/Mozilla/Boot_to_Gecko/Debugging_on_Boot_to_Gecko/Setting_up
  • 45. UI BUILDING BLOCKS Keeping a consistent style
  • 46. Gaia UI Building Blocks https://github.com/mozilla-b2g/Gaia-UI-Building-Blocks
  • 49. EASING APP DEVELOPMENT Templates and frameworks
  • 50. Mortar is the recommend set of Web app templates for Firefox OS https://github.com/mozilla/mortar
  • 54. HTML5 Boilerplate build script (using Grunt) https://github.com/h5bp/node-build-script
  • 62. FIREFOX OS SIMULATOR Perfect for testing Firefox OS apps Firefox OS Simulator https://addons.mozilla.org/en-US/firefox/addon/firefox-os-simulator/
  • 63.
  • 65. Apps area on MDN https://developer.mozilla.org/en-US/docs/Apps
  • 66. Firefox Marketplace Developer Hub https://marketplace.firefox.com/developers/
  • 67. HTML5 Rocks article on mobile performance http://www.html5rocks.com/en/mobile/optimization-and-performance/
  • 68. Sam Dutton’s talk on mobile Web app performance and optimisation http://www.samdutton.com/velocity2012/
  • 69. Tasneem Sayeed’s talk on improving mobile Web app experience http://www.slideshare.net/tasneemsayeed/developer-pitfalls-strategies-for-improving-mobile-web-developer- experience
  • 70. Mobile Web app best practices from the W3C http://www.w3.org/TR/mwabp/