SlideShare a Scribd company logo
Single Page Applications: The Basics
Concepts, Gotchas and Just Things
You Need To Know
High Performance Single Page Web
Applications
• Responsive Design
• Touch
• Mobile First
• SPA
• Extensible, Scalable Architecture
• Web Build and Workflow
• Goes Really Fast!
• ~395 Pages
• 20 Chapters
• $9.99
http://amzn.to/1a55L89
What is a SPA?
• A SPA is a new architecture for delivering rich user experiences in web
applications that leverage modern web (HTML5, CSS3 and AJAX)
capabilities.
• The Application Resides in the Browser
• User Experience is Primary Goal
What is a SPA?
• Single Page Applications have become a must do approach as more
and more end users utilize mobile class computers.
What is a SPA?
• The modern web client requires a different approach, a user first
approach.
SPA Fundamentals
• Not Meant for Legacy Browsers
• Many Server-Side responsibilities now reside in the browser
• Applications are composed of APIs
• The role of the web server has changed from service that performs the heavy lifting to compose markup to a
much simpler process
• Only 1 URL to GET core Markup
• AJAX is used to GET Data
• Routing is managed using the URL hash fragment, #
• #! has become the defacto standard and is reccomended by Google for SEO
• Data is bound to markup to compose rendered views in the browser
• The client application is decoupled from the server
• The client is responsible for managing markup and data
• CSS transitions and animations provide a rich experience to transition between views
• SEO does not have to be sacrificed. Google has a SPA specification
Why Only Modern Browsers?
• The APIs, performance and many features modern browsers offer
were not implemented in legacy browsers.
Early Feature Detection to ‘Cut the Mustard’
<script>
var ef = "?_escaped_fragment_=";
if (!('querySelector' in document) || !('localStorage' in window) || !('addEventListener' in window) || !('matchMedia' in window)) {
if (window.location.href.indexOf("#!") > 0) {
window.location.href = window.location.href.replace("#!", ef);
} else {
if (window.location.href.indexOf(ef) < 0) {
window.location.href = window.location.href + ef;
}
}
} else {
if (window.location.href.indexOf(ef) >= 0) {
window.location.href = window.location.href.replace(ef, "#!");
}
}
</script>
What the Heck is a Core Site?
• Allows You to Serve Legacy Browsers & Search Engine Spiders
• Is a ‘minimal’ site
• Use Progressive Enhancement Concepts
• Use Legacy Web Site Development Techniques
• Minimal JavaScript and CSS
Only 1 URL to GET Core Markup
• Just as the name, Single Page Application, implies a single request to
the server for a web page is made during the application's life cycle.
This means developers need to make some architectural decisions to
deliver the application.
• Inline Views
• Script Tags
• Hidden Elements
Markup Management & Persistence
• Non-Current View Markup Should Not Reside in the DOM
• Persist it Outside the DOM
• Cache Markup
• Memory
• Browser Storage
AJAX Used to Get Data & The Role of the
Server
• AJAX Makes it Possible to Request Data from Server
• No Longer Need Full Page Request
• Can Return All Sorts of ‘Data’
• APIs Should Return JSON Formatted Data
• Use Data Caching Strategy
• The Fastest HTTP Request is the one Never Made
• Browser Storage Is a Good Caching Medium
SPA Routing Fundamentals
• Routing drives any web site or application
• Utilizes the Address’s Hash Fragment, #
• #! Is the Defacto Standard
• Triggers hashchange Event
• #!movie/:id/:title
SPA Routing Fundamentals
• Hard Coded Routing is Most Common
• Brittle
• Difficult to Maintain
• Declarative
• Embeds Route with View
<section id="movieView" class="content-pane"
spa-title=" "
spa-transition="slide"
spa-route="movie/:id/:title">
</section>
View Swapping
• Exchanging views or view swapping is at the heart of a SPA's user
experience
Data Binding Options
• A good SPA experience injects data as the view is being hydrated
• Push Libraries like MUSTACHE
• Compile Markup with Data Before Stamping it in the DOM
• Binding Libraries
• Knockout, Angular’s Compiler
• Rivets
• Evaluate for Memory Leaks!!!
Creating Rich View Transitions
• You Can just Show and Hide Views
• But that is Boring
• Instead Use Animations
• CSS Transitions & Key-Frame Animations
• Animate.css is a Set of Turn-Key CSS Animations
• http://daneden.github.io/animate.css/
Accounting for SEO & Legacy Browsers
• Utilize a Core Site
• Google Published a Specification
• http://bit.ly/117sTgL
• Convert SPA Route to a QueryString Parameter
• ?_escaped_fragment_={SPA Route}
Thank You!
• Responsive Design
• Touch
• Mobile First
• SPA
• Extensible, Scalable Architecture
• Web Build and Workflow
• Goes Really Fast!
• ~395 Pages
• 20 Chapters
• $9.99
http://amzn.to/1a55L89
Ad

More Related Content

What's hot (20)

Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
John McCaffrey
 
BD Conf: Visit speed - Page speed is only the beginning
BD Conf: Visit speed - Page speed is only the beginningBD Conf: Visit speed - Page speed is only the beginning
BD Conf: Visit speed - Page speed is only the beginning
Peter McLachlan
 
Tim Scollick - Flex, Seo And You
Tim Scollick - Flex, Seo And YouTim Scollick - Flex, Seo And You
Tim Scollick - Flex, Seo And You
Refresh Events
 
High Performance Web/Mobile Pages - Automation
High Performance Web/Mobile Pages - AutomationHigh Performance Web/Mobile Pages - Automation
High Performance Web/Mobile Pages - Automation
soheil416
 
Web performance optimization for modern web applications
Web performance optimization for modern web applicationsWeb performance optimization for modern web applications
Web performance optimization for modern web applications
Chris Love
 
Optimizing web performance (Fronteers edition)
Optimizing web performance (Fronteers edition)Optimizing web performance (Fronteers edition)
Optimizing web performance (Fronteers edition)
Dave Olsen
 
Pearls and Must-Have Tools for the Modern Web / .NET Developer
Pearls and Must-Have Tools for the Modern Web / .NET DeveloperPearls and Must-Have Tools for the Modern Web / .NET Developer
Pearls and Must-Have Tools for the Modern Web / .NET Developer
Ofer Zelig
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
John McCaffrey
 
Mobile web performance dwx13
Mobile web performance dwx13Mobile web performance dwx13
Mobile web performance dwx13
Avenga Germany GmbH
 
Meeting Archive: A Simple Step to Gain 33% Performance Improvements in Reques...
Meeting Archive: A Simple Step to Gain 33% Performance Improvements in Reques...Meeting Archive: A Simple Step to Gain 33% Performance Improvements in Reques...
Meeting Archive: A Simple Step to Gain 33% Performance Improvements in Reques...
Meghan Weinreich
 
Ajax
AjaxAjax
Ajax
baabtra.com - No. 1 supplier of quality freshers
 
Page Experience Update SMX 2020 (Aleks Shklyar)
Page Experience Update SMX 2020 (Aleks Shklyar)Page Experience Update SMX 2020 (Aleks Shklyar)
Page Experience Update SMX 2020 (Aleks Shklyar)
Aleks (Aleksander) Shklyar
 
Fast and Easy Website Tuneups
Fast and Easy Website TuneupsFast and Easy Website Tuneups
Fast and Easy Website Tuneups
Jeff Wisniewski
 
Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015
Alan Lok
 
SEO AJAX Crawlability in a Responsive Publisher World
SEO AJAX Crawlability in a Responsive Publisher WorldSEO AJAX Crawlability in a Responsive Publisher World
SEO AJAX Crawlability in a Responsive Publisher World
Eric Wu
 
improving the performance of Rails web Applications
improving the performance of Rails web Applicationsimproving the performance of Rails web Applications
improving the performance of Rails web Applications
John McCaffrey
 
My Website Is Old Enough To Vote - Kris Howard
My Website Is Old Enough To Vote - Kris HowardMy Website Is Old Enough To Vote - Kris Howard
My Website Is Old Enough To Vote - Kris Howard
WordCamp Sydney
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development Fundamentals
Mohammed Makhlouf
 
Rev Your Engines: SharePoint Performance Best Practices
Rev Your Engines: SharePoint Performance Best PracticesRev Your Engines: SharePoint Performance Best Practices
Rev Your Engines: SharePoint Performance Best Practices
SPC Adriatics
 
Web performance: beyond load testing
Web performance: beyond load testingWeb performance: beyond load testing
Web performance: beyond load testing
SergeyChernyshev
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
John McCaffrey
 
BD Conf: Visit speed - Page speed is only the beginning
BD Conf: Visit speed - Page speed is only the beginningBD Conf: Visit speed - Page speed is only the beginning
BD Conf: Visit speed - Page speed is only the beginning
Peter McLachlan
 
Tim Scollick - Flex, Seo And You
Tim Scollick - Flex, Seo And YouTim Scollick - Flex, Seo And You
Tim Scollick - Flex, Seo And You
Refresh Events
 
High Performance Web/Mobile Pages - Automation
High Performance Web/Mobile Pages - AutomationHigh Performance Web/Mobile Pages - Automation
High Performance Web/Mobile Pages - Automation
soheil416
 
Web performance optimization for modern web applications
Web performance optimization for modern web applicationsWeb performance optimization for modern web applications
Web performance optimization for modern web applications
Chris Love
 
Optimizing web performance (Fronteers edition)
Optimizing web performance (Fronteers edition)Optimizing web performance (Fronteers edition)
Optimizing web performance (Fronteers edition)
Dave Olsen
 
Pearls and Must-Have Tools for the Modern Web / .NET Developer
Pearls and Must-Have Tools for the Modern Web / .NET DeveloperPearls and Must-Have Tools for the Modern Web / .NET Developer
Pearls and Must-Have Tools for the Modern Web / .NET Developer
Ofer Zelig
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
John McCaffrey
 
Meeting Archive: A Simple Step to Gain 33% Performance Improvements in Reques...
Meeting Archive: A Simple Step to Gain 33% Performance Improvements in Reques...Meeting Archive: A Simple Step to Gain 33% Performance Improvements in Reques...
Meeting Archive: A Simple Step to Gain 33% Performance Improvements in Reques...
Meghan Weinreich
 
Page Experience Update SMX 2020 (Aleks Shklyar)
Page Experience Update SMX 2020 (Aleks Shklyar)Page Experience Update SMX 2020 (Aleks Shklyar)
Page Experience Update SMX 2020 (Aleks Shklyar)
Aleks (Aleksander) Shklyar
 
Fast and Easy Website Tuneups
Fast and Easy Website TuneupsFast and Easy Website Tuneups
Fast and Easy Website Tuneups
Jeff Wisniewski
 
Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015
Alan Lok
 
SEO AJAX Crawlability in a Responsive Publisher World
SEO AJAX Crawlability in a Responsive Publisher WorldSEO AJAX Crawlability in a Responsive Publisher World
SEO AJAX Crawlability in a Responsive Publisher World
Eric Wu
 
improving the performance of Rails web Applications
improving the performance of Rails web Applicationsimproving the performance of Rails web Applications
improving the performance of Rails web Applications
John McCaffrey
 
My Website Is Old Enough To Vote - Kris Howard
My Website Is Old Enough To Vote - Kris HowardMy Website Is Old Enough To Vote - Kris Howard
My Website Is Old Enough To Vote - Kris Howard
WordCamp Sydney
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development Fundamentals
Mohammed Makhlouf
 
Rev Your Engines: SharePoint Performance Best Practices
Rev Your Engines: SharePoint Performance Best PracticesRev Your Engines: SharePoint Performance Best Practices
Rev Your Engines: SharePoint Performance Best Practices
SPC Adriatics
 
Web performance: beyond load testing
Web performance: beyond load testingWeb performance: beyond load testing
Web performance: beyond load testing
SergeyChernyshev
 

Similar to Single page applications the basics (20)

HTML5: the new frontier of the web
HTML5: the new frontier of the webHTML5: the new frontier of the web
HTML5: the new frontier of the web
Ivano Malavolta
 
A Day Building Fast, Responsive, Extensible Single Page Applications
A Day Building Fast, Responsive, Extensible Single Page ApplicationsA Day Building Fast, Responsive, Extensible Single Page Applications
A Day Building Fast, Responsive, Extensible Single Page Applications
Chris Love
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
ASG
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
Jeremy Likness
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
Gil Fink
 
Web Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the futureWeb Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the future
Toru Kawamura
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
Alfresco Software
 
Develop a vanilla.js spa you and your customers will love
Develop a vanilla.js spa you and your customers will loveDevelop a vanilla.js spa you and your customers will love
Develop a vanilla.js spa you and your customers will love
Chris Love
 
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
Timothy Fisher
 
REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)
Sascha Wenninger
 
Building SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.jsBuilding SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.js
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
SPTechCon
 
A night at the spa
A night at the spaA night at the spa
A night at the spa
Chris Love
 
Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta
Commit University
 
Build Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJSBuild Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJS
Taiseer Joudeh
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples
Yochay Kiriaty
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
Timothy Fisher
 
Meanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore ChandraMeanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore Chandra
Kishore Chandra
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
Krishnaprasad k
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
Krishnaprasad k
 
HTML5: the new frontier of the web
HTML5: the new frontier of the webHTML5: the new frontier of the web
HTML5: the new frontier of the web
Ivano Malavolta
 
A Day Building Fast, Responsive, Extensible Single Page Applications
A Day Building Fast, Responsive, Extensible Single Page ApplicationsA Day Building Fast, Responsive, Extensible Single Page Applications
A Day Building Fast, Responsive, Extensible Single Page Applications
Chris Love
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
ASG
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
Jeremy Likness
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
Gil Fink
 
Web Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the futureWeb Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the future
Toru Kawamura
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
Alfresco Software
 
Develop a vanilla.js spa you and your customers will love
Develop a vanilla.js spa you and your customers will loveDevelop a vanilla.js spa you and your customers will love
Develop a vanilla.js spa you and your customers will love
Chris Love
 
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
Timothy Fisher
 
REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)
Sascha Wenninger
 
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
SPTechCon
 
A night at the spa
A night at the spaA night at the spa
A night at the spa
Chris Love
 
Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta
Commit University
 
Build Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJSBuild Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJS
Taiseer Joudeh
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples
Yochay Kiriaty
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
Timothy Fisher
 
Meanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore ChandraMeanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore Chandra
Kishore Chandra
 
Ad

More from Chris Love (20)

Quick Fetch API Introduction
Quick Fetch API IntroductionQuick Fetch API Introduction
Quick Fetch API Introduction
Chris Love
 
Introduction to Progressive Web Applications
Introduction to Progressive Web ApplicationsIntroduction to Progressive Web Applications
Introduction to Progressive Web Applications
Chris Love
 
Introduction to Progressive Web Applications
Introduction to Progressive Web ApplicationsIntroduction to Progressive Web Applications
Introduction to Progressive Web Applications
Chris Love
 
Lazy load Website Assets
Lazy load Website AssetsLazy load Website Assets
Lazy load Website Assets
Chris Love
 
Progressive Web Apps for Education
Progressive Web Apps for EducationProgressive Web Apps for Education
Progressive Web Apps for Education
Chris Love
 
The server is dead going serverless to create a highly scalable application y...
The server is dead going serverless to create a highly scalable application y...The server is dead going serverless to create a highly scalable application y...
The server is dead going serverless to create a highly scalable application y...
Chris Love
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingReal World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker Caching
Chris Love
 
Disrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applicationsDisrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applications
Chris Love
 
Service workers your applications never felt so good
Service workers   your applications never felt so goodService workers   your applications never felt so good
Service workers your applications never felt so good
Chris Love
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
Chris Love
 
Advanced front end debugging with ms edge and ms tools
Advanced front end debugging with ms edge and ms toolsAdvanced front end debugging with ms edge and ms tools
Advanced front end debugging with ms edge and ms tools
Chris Love
 
Html5 Fit: Get Rid of Love Handles
Html5 Fit:  Get Rid of Love HandlesHtml5 Fit:  Get Rid of Love Handles
Html5 Fit: Get Rid of Love Handles
Chris Love
 
Using Responsive Web Design To Make Your Web Work Everywhere - Updated
Using Responsive Web Design To Make Your Web Work Everywhere - UpdatedUsing Responsive Web Design To Make Your Web Work Everywhere - Updated
Using Responsive Web Design To Make Your Web Work Everywhere - Updated
Chris Love
 
Implementing a Responsive Image Strategy
Implementing a Responsive Image StrategyImplementing a Responsive Image Strategy
Implementing a Responsive Image Strategy
Chris Love
 
Using Responsive Web Design To Make Your Web Work Everywhere
Using Responsive Web Design To Make Your Web Work EverywhereUsing Responsive Web Design To Make Your Web Work Everywhere
Using Responsive Web Design To Make Your Web Work Everywhere
Chris Love
 
10 things you can do to speed up your web app today 2016
10 things you can do to speed up your web app today 201610 things you can do to speed up your web app today 2016
10 things you can do to speed up your web app today 2016
Chris Love
 
Css best practices style guide and tips
Css best practices style guide and tipsCss best practices style guide and tips
Css best practices style guide and tips
Chris Love
 
Using Responsive Web Design To Make Your Web Work Everywhere
Using Responsive Web Design To Make Your Web Work Everywhere Using Responsive Web Design To Make Your Web Work Everywhere
Using Responsive Web Design To Make Your Web Work Everywhere
Chris Love
 
An Introduction to Microsoft Edge
An Introduction to Microsoft EdgeAn Introduction to Microsoft Edge
An Introduction to Microsoft Edge
Chris Love
 
There Is No Mobile: An Introduction To Responsive Web Design
There Is No Mobile: An Introduction To Responsive Web DesignThere Is No Mobile: An Introduction To Responsive Web Design
There Is No Mobile: An Introduction To Responsive Web Design
Chris Love
 
Quick Fetch API Introduction
Quick Fetch API IntroductionQuick Fetch API Introduction
Quick Fetch API Introduction
Chris Love
 
Introduction to Progressive Web Applications
Introduction to Progressive Web ApplicationsIntroduction to Progressive Web Applications
Introduction to Progressive Web Applications
Chris Love
 
Introduction to Progressive Web Applications
Introduction to Progressive Web ApplicationsIntroduction to Progressive Web Applications
Introduction to Progressive Web Applications
Chris Love
 
Lazy load Website Assets
Lazy load Website AssetsLazy load Website Assets
Lazy load Website Assets
Chris Love
 
Progressive Web Apps for Education
Progressive Web Apps for EducationProgressive Web Apps for Education
Progressive Web Apps for Education
Chris Love
 
The server is dead going serverless to create a highly scalable application y...
The server is dead going serverless to create a highly scalable application y...The server is dead going serverless to create a highly scalable application y...
The server is dead going serverless to create a highly scalable application y...
Chris Love
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingReal World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker Caching
Chris Love
 
Disrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applicationsDisrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applications
Chris Love
 
Service workers your applications never felt so good
Service workers   your applications never felt so goodService workers   your applications never felt so good
Service workers your applications never felt so good
Chris Love
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
Chris Love
 
Advanced front end debugging with ms edge and ms tools
Advanced front end debugging with ms edge and ms toolsAdvanced front end debugging with ms edge and ms tools
Advanced front end debugging with ms edge and ms tools
Chris Love
 
Html5 Fit: Get Rid of Love Handles
Html5 Fit:  Get Rid of Love HandlesHtml5 Fit:  Get Rid of Love Handles
Html5 Fit: Get Rid of Love Handles
Chris Love
 
Using Responsive Web Design To Make Your Web Work Everywhere - Updated
Using Responsive Web Design To Make Your Web Work Everywhere - UpdatedUsing Responsive Web Design To Make Your Web Work Everywhere - Updated
Using Responsive Web Design To Make Your Web Work Everywhere - Updated
Chris Love
 
Implementing a Responsive Image Strategy
Implementing a Responsive Image StrategyImplementing a Responsive Image Strategy
Implementing a Responsive Image Strategy
Chris Love
 
Using Responsive Web Design To Make Your Web Work Everywhere
Using Responsive Web Design To Make Your Web Work EverywhereUsing Responsive Web Design To Make Your Web Work Everywhere
Using Responsive Web Design To Make Your Web Work Everywhere
Chris Love
 
10 things you can do to speed up your web app today 2016
10 things you can do to speed up your web app today 201610 things you can do to speed up your web app today 2016
10 things you can do to speed up your web app today 2016
Chris Love
 
Css best practices style guide and tips
Css best practices style guide and tipsCss best practices style guide and tips
Css best practices style guide and tips
Chris Love
 
Using Responsive Web Design To Make Your Web Work Everywhere
Using Responsive Web Design To Make Your Web Work Everywhere Using Responsive Web Design To Make Your Web Work Everywhere
Using Responsive Web Design To Make Your Web Work Everywhere
Chris Love
 
An Introduction to Microsoft Edge
An Introduction to Microsoft EdgeAn Introduction to Microsoft Edge
An Introduction to Microsoft Edge
Chris Love
 
There Is No Mobile: An Introduction To Responsive Web Design
There Is No Mobile: An Introduction To Responsive Web DesignThere Is No Mobile: An Introduction To Responsive Web Design
There Is No Mobile: An Introduction To Responsive Web Design
Chris Love
 
Ad

Single page applications the basics

  • 1. Single Page Applications: The Basics Concepts, Gotchas and Just Things You Need To Know
  • 2. High Performance Single Page Web Applications • Responsive Design • Touch • Mobile First • SPA • Extensible, Scalable Architecture • Web Build and Workflow • Goes Really Fast! • ~395 Pages • 20 Chapters • $9.99 http://amzn.to/1a55L89
  • 3. What is a SPA? • A SPA is a new architecture for delivering rich user experiences in web applications that leverage modern web (HTML5, CSS3 and AJAX) capabilities. • The Application Resides in the Browser • User Experience is Primary Goal
  • 4. What is a SPA? • Single Page Applications have become a must do approach as more and more end users utilize mobile class computers.
  • 5. What is a SPA? • The modern web client requires a different approach, a user first approach.
  • 6. SPA Fundamentals • Not Meant for Legacy Browsers • Many Server-Side responsibilities now reside in the browser • Applications are composed of APIs • The role of the web server has changed from service that performs the heavy lifting to compose markup to a much simpler process • Only 1 URL to GET core Markup • AJAX is used to GET Data • Routing is managed using the URL hash fragment, # • #! has become the defacto standard and is reccomended by Google for SEO • Data is bound to markup to compose rendered views in the browser • The client application is decoupled from the server • The client is responsible for managing markup and data • CSS transitions and animations provide a rich experience to transition between views • SEO does not have to be sacrificed. Google has a SPA specification
  • 7. Why Only Modern Browsers? • The APIs, performance and many features modern browsers offer were not implemented in legacy browsers.
  • 8. Early Feature Detection to ‘Cut the Mustard’ <script> var ef = "?_escaped_fragment_="; if (!('querySelector' in document) || !('localStorage' in window) || !('addEventListener' in window) || !('matchMedia' in window)) { if (window.location.href.indexOf("#!") > 0) { window.location.href = window.location.href.replace("#!", ef); } else { if (window.location.href.indexOf(ef) < 0) { window.location.href = window.location.href + ef; } } } else { if (window.location.href.indexOf(ef) >= 0) { window.location.href = window.location.href.replace(ef, "#!"); } } </script>
  • 9. What the Heck is a Core Site? • Allows You to Serve Legacy Browsers & Search Engine Spiders • Is a ‘minimal’ site • Use Progressive Enhancement Concepts • Use Legacy Web Site Development Techniques • Minimal JavaScript and CSS
  • 10. Only 1 URL to GET Core Markup • Just as the name, Single Page Application, implies a single request to the server for a web page is made during the application's life cycle. This means developers need to make some architectural decisions to deliver the application. • Inline Views • Script Tags • Hidden Elements
  • 11. Markup Management & Persistence • Non-Current View Markup Should Not Reside in the DOM • Persist it Outside the DOM • Cache Markup • Memory • Browser Storage
  • 12. AJAX Used to Get Data & The Role of the Server • AJAX Makes it Possible to Request Data from Server • No Longer Need Full Page Request • Can Return All Sorts of ‘Data’ • APIs Should Return JSON Formatted Data • Use Data Caching Strategy • The Fastest HTTP Request is the one Never Made • Browser Storage Is a Good Caching Medium
  • 13. SPA Routing Fundamentals • Routing drives any web site or application • Utilizes the Address’s Hash Fragment, # • #! Is the Defacto Standard • Triggers hashchange Event • #!movie/:id/:title
  • 14. SPA Routing Fundamentals • Hard Coded Routing is Most Common • Brittle • Difficult to Maintain • Declarative • Embeds Route with View <section id="movieView" class="content-pane" spa-title=" " spa-transition="slide" spa-route="movie/:id/:title"> </section>
  • 15. View Swapping • Exchanging views or view swapping is at the heart of a SPA's user experience
  • 16. Data Binding Options • A good SPA experience injects data as the view is being hydrated • Push Libraries like MUSTACHE • Compile Markup with Data Before Stamping it in the DOM • Binding Libraries • Knockout, Angular’s Compiler • Rivets • Evaluate for Memory Leaks!!!
  • 17. Creating Rich View Transitions • You Can just Show and Hide Views • But that is Boring • Instead Use Animations • CSS Transitions & Key-Frame Animations • Animate.css is a Set of Turn-Key CSS Animations • http://daneden.github.io/animate.css/
  • 18. Accounting for SEO & Legacy Browsers • Utilize a Core Site • Google Published a Specification • http://bit.ly/117sTgL • Convert SPA Route to a QueryString Parameter • ?_escaped_fragment_={SPA Route}
  • 19. Thank You! • Responsive Design • Touch • Mobile First • SPA • Extensible, Scalable Architecture • Web Build and Workflow • Goes Really Fast! • ~395 Pages • 20 Chapters • $9.99 http://amzn.to/1a55L89