SlideShare a Scribd company logo
1 of 35
Download to read offline
Things I've learnt from my
Hacker News web app
Hello, I'm Chee Aun.
• Hardcore web developer.
• Created quite a bunch of fun little side projects.
• Tweet a lot of interesting stuff at @cheeaun
• Occasionally read Hacker News.
What is
Hacker News?
news.ycombinator.com
I built
HackerWeb.
HackerWeb
• A simple read-only web app client for Hacker News.
• Mobile-optimized, iOS-optimized.
• Works on all modern browsers, hopefully.
• Check it out at hackerwebapp.com
Cutting-edge web tech
-webkit-overflow-scrolling: touch, localStorage,
sessionStorage, CORS, Application Cache, CSS
Animation, CSS Media Queries, Flexible Box Layout
(old spec), requestAnimationFrame, Web Workers,
and more…
Must-reads
• How I built the Hacker News mobile web app
• How I built the Hacker News mobile web app, Part 2
• Introducing HackerWeb
Focus on 3 things
1. -webkit-overflow-scrolling: touch
  (Momentum scrolling)
2. CORS (Cross-Origin Resource Sharing)
3. Application Cache
1

Momentum
 scrolling
-webkit-overflow-scrolling:
  touch
• iOS-specific, for now. No official spec.
• Introduced since iOS5 (October 2011).
• For overflow:scroll elements.
Before iOS5
• Two fingers to scroll overflow:scroll
  elements.
• Unintuitive and undiscoverable.
• Scrolling libs to the rescue: iScroll, Scrollability,
  TouchScroll, FTScroller, etc
Starting from iOS5
• One finger to scroll overflow:scroll elements.
• -webkit-overflow-scrolling: touch
  adds momentum to it.
• Scrolling libs are still in used due to bugs/quirks.
• Bug: Can't scroll to top when tapping status bar
Demo time
• Normal scrolling: jsbin.com/uhiyac/1
• Momentum scrolling: jsbin.com/uhiyac/2
Resources
• Overthrow – overflow:auto polyfill
• jQuery Mobile: touchOverflow
• Nested divs with overflow:touch
2

CORS
Before CORS
• Use JSONP.
• Request data from a server in a different domain.
• Example: json-head.appspot.com/?
  url=http://www.google.com/&callback=test
• A “hack”.
CORS
• A W3C Working Draft.
• Allow JavaScript to make cross-domain requests.
• An interplay between the server and the client.


   Access-Control-Allow-Origin: *
Use CORS
 today!
Who implements CORS?
• Google APIs
• Amazon S3
• YouTube API
• Dropbox API
• GitHub v3 API
• …and more
Resources
• Enable CORS
• CORS isn’t just for XHR
• Can I use CORS?
• Using CORS - HTML5 Rocks
• CORS Proxy
3

Application
  Cache
AppCache
• Easily make your web site/app offline.
• A working draft.
• A douchebag.
Super simple steps
Step 1.
 <html manifest="manifest.appcache">
Step 2.
 CACHE MANIFEST
 index.html
 stylesheet.css
 …
Versioning
CACHE MANIFEST
# 2013-01-21:v1

index.html
stylesheet.css
…
Google Reader
Reeddit – Reddit web app client
Track AppCache versions
Use Google Analytics' event tracking
Make local dev easier
• Serve 404 for .appcache files
• For HackerWeb, I use node server.js
  -noappcache
Resources
• A Beginner's Guide to Using the Application Cache
• Fixing Application Cache Community Group
• Appcache Facts
More resources
• Moobile – new mobile application framework built
  on MooTools
• Ratchet – Prototype iPhone apps with simple HTML,
  CSS and JS components
• HTML5 Rocks
• Can I use…
Thanks
• cheeaun.com
• twitter.com/cheeaun
• github.com/cheeaun


  Images used in this presentation
• flickr.com/photos/diathesis/2262012694/

More Related Content

What's hot

HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashed
Peter Lubbers
 
Building for success and failure with Disqus
Building for success and failure with DisqusBuilding for success and failure with Disqus
Building for success and failure with Disqus
Jonathon Hill
 

What's hot (20)

Odin Authenticator
Odin AuthenticatorOdin Authenticator
Odin Authenticator
 
Future of web_apps
Future of web_appsFuture of web_apps
Future of web_apps
 
Beyond The Browser - Creating a RESTful Web Service With WordPress
Beyond The Browser - Creating a RESTful Web Service With WordPressBeyond The Browser - Creating a RESTful Web Service With WordPress
Beyond The Browser - Creating a RESTful Web Service With WordPress
 
A Day of REST
A Day of RESTA Day of REST
A Day of REST
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011
 
JavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right ChoiceJavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right Choice
 
Kickstarter Your Node.JS Application
Kickstarter Your Node.JS ApplicationKickstarter Your Node.JS Application
Kickstarter Your Node.JS Application
 
Meanstack overview
Meanstack overviewMeanstack overview
Meanstack overview
 
Maine WordPress Meetup JSON REST API, 3/16/2016
Maine WordPress Meetup JSON REST API, 3/16/2016Maine WordPress Meetup JSON REST API, 3/16/2016
Maine WordPress Meetup JSON REST API, 3/16/2016
 
Ansible
AnsibleAnsible
Ansible
 
REST In Action: The Live Coverage Platform at the New York Times
REST In Action: The Live Coverage Platform at the New York TimesREST In Action: The Live Coverage Platform at the New York Times
REST In Action: The Live Coverage Platform at the New York Times
 
2015 WordCamp Maine Keynote
2015 WordCamp Maine Keynote2015 WordCamp Maine Keynote
2015 WordCamp Maine Keynote
 
Avoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.jsAvoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.js
 
HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashed
 
Web Crawler
Web CrawlerWeb Crawler
Web Crawler
 
Live Coverage at The New York Times
Live Coverage at The New York TimesLive Coverage at The New York Times
Live Coverage at The New York Times
 
Getting Started with WordPress JSON REST API
Getting Started with WordPress JSON REST APIGetting Started with WordPress JSON REST API
Getting Started with WordPress JSON REST API
 
Versions are evil – how to do without in your API
Versions are evil – how to do without in your APIVersions are evil – how to do without in your API
Versions are evil – how to do without in your API
 
Testing your Single Page Application
Testing your Single Page ApplicationTesting your Single Page Application
Testing your Single Page Application
 
Building for success and failure with Disqus
Building for success and failure with DisqusBuilding for success and failure with Disqus
Building for success and failure with Disqus
 

Viewers also liked (8)

Tresoar GO social
Tresoar GO socialTresoar GO social
Tresoar GO social
 
Isheila doet Marathon Rotterdam
Isheila doet Marathon RotterdamIsheila doet Marathon Rotterdam
Isheila doet Marathon Rotterdam
 
Designing Firefox Themes
Designing Firefox ThemesDesigning Firefox Themes
Designing Firefox Themes
 
Pentago on Wave
Pentago on WavePentago on Wave
Pentago on Wave
 
Lets Look At Webquests
Lets Look At  WebquestsLets Look At  Webquests
Lets Look At Webquests
 
How I got started in JavaScript
How I got started in JavaScriptHow I got started in JavaScript
How I got started in JavaScript
 
Pedagogy To Practice
Pedagogy To PracticePedagogy To Practice
Pedagogy To Practice
 
M3 Class vivid vocab work
M3 Class vivid vocab workM3 Class vivid vocab work
M3 Class vivid vocab work
 

Similar to Things I've learnt from my Hacker News web app

GeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPressGeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPress
GGDBologna
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
davyjones
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
Nuxeo
 

Similar to Things I've learnt from my Hacker News web app (20)

the web is mobile
the web is mobilethe web is mobile
the web is mobile
 
Isomorphic web application
Isomorphic web applicationIsomorphic web application
Isomorphic web application
 
Getting the-native-feel
Getting the-native-feelGetting the-native-feel
Getting the-native-feel
 
DjangoSki
DjangoSkiDjangoSki
DjangoSki
 
Rhodes
RhodesRhodes
Rhodes
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
DIGIT Noe 2016 - Overview of front end development today
DIGIT Noe 2016 - Overview of front end development todayDIGIT Noe 2016 - Overview of front end development today
DIGIT Noe 2016 - Overview of front end development today
 
Mobile Hybrid Development with WordPress
Mobile Hybrid Development with WordPressMobile Hybrid Development with WordPress
Mobile Hybrid Development with WordPress
 
GeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPressGeneralMobile Hybrid Development with WordPress
GeneralMobile Hybrid Development with WordPress
 
Building iOS app using meteor
Building iOS app using meteorBuilding iOS app using meteor
Building iOS app using meteor
 
VelocityConf EU 2013 - Turbocharge your mobile web apps by using offline
VelocityConf EU 2013 - Turbocharge your mobile web apps by using offline VelocityConf EU 2013 - Turbocharge your mobile web apps by using offline
VelocityConf EU 2013 - Turbocharge your mobile web apps by using offline
 
Decoupled Architecture and WordPress
Decoupled Architecture and WordPressDecoupled Architecture and WordPress
Decoupled Architecture and WordPress
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
Velocity building a performance lab for mobile apps in a day - final
Velocity   building a performance lab for mobile apps in a day - finalVelocity   building a performance lab for mobile apps in a day - final
Velocity building a performance lab for mobile apps in a day - final
 
The Mobile Development Landscape
The Mobile Development LandscapeThe Mobile Development Landscape
The Mobile Development Landscape
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices (updated) (v.1.1) External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices (updated) (v.1.1)
 
Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...
Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...
Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...
 

Things I've learnt from my Hacker News web app