SlideShare une entreprise Scribd logo
1  sur  15
S.P.A-SINGLE PAGE APPLICATION
It's also single-page interface (SPI), is a web application or web site
that fits on a single web page with the goal of providing a more fluid
user experience akin(same) to a desktop application
In a SPA, either all necessary code – HTML, JavaScript, and CSS – is
retrieved with a single page load,or the appropriate resources are
dynamically loaded and added to the page as necessary, usually in
response to user actions.
S.P.A
The page does not reload at any point in the process, nor does control transfer
to another page, although modern web technologies (such as those included in
HTML5) can provide the perception and navigability of separate logical
pages in the application. Interaction with the single page application often
involves dynamic communication with the web server behind the scenes.
The term single-page application was coined by Steve Yen in 2005,
few distinct characteristics of the
professional Single Page Application:

CHUNKING

CONTROLLERS

TEMPLATING

ROUTING

REAL-TIME COMMUNICATION

LOCAL STORAGE

CHUNKING-the web page is constructed by loading chunks of
HTML fragments and JSON data instead of receiving full HTML
from a web server on every request. (Backbone.js, pjax, jQuery,
Upshot.js)

CONTROLLERS-JavaScript code that handles complex DOM
and data manipulations, application logic and AJAX calls is
replaced by controllers that separate views and models using MVC
or MVVM patterns. (Backbone.js, Knockout.js, JavascriptMVC)

TEMPLATING-coding of UI and DOM manipulations are replaced
by declarative binding of data to HTML templates. (Knockout.js,
Mustache, jQuery Templates, Underscore.js)

Routing – selection of views and navigation (without
page reloads) that preserves page state, elements and
data (History.js, Crossroads.js, Backbone.js, pjax,
HTML5 History API)

Real-time communication – two-way communication
of a client application and web server replaces one-way
requests from a browser (HTML5 Web Sockets,
Socket.io, SignalR)

Local storage – capabilities of storing data on a
browser for performance and offline access replace
cookies and intensive data loads from web server
(HTML5 Local storage).
Javascript frameworks(angularjs)

AngularJS is a fully client-side library. AngularJS's templating is
based on bidirectional data binding.

Data-binding is an automatic way of updating the view whenever
the model changes, as well as updating the model whenever the
view changes.

The html template is compiled in the browser. The compilation step
creates pure html, upon which the browser re-renders into the live
view. The step is repeated for subsequent page views.

In traditional server-side html programming, concepts such as
controller and model interact within a server process to produce
new html views.

In the AngularJS framework, the controller and model state are
maintained within the client browser. Therefore new pages are
generated without any interaction with a server.

Websockets:

WebSockets are a part of HTML5 spec and is used for single page apps

Browser plugins:

Asynchronous calls to the server may also be achieved using browser
plug-in technologies such as Silverlight, Flash, or Java applets.

Data transport (XML, JSON and AJAX):

Requests to the server typically result in either raw data (e.g. XML or
JSON), or new HTML being returned. In the case where HTML is
returned by the server, JavaScript on the client updates a partial area of
the DOM (Document Object Model). When raw data is returned, often a
client-side JavaScript XML / (XSL) process ( and in case of JSON a
template ) is used to translate the raw data into HTML, which is then used
to update a partial area of the DOM.
DOM

The Document Object Model (DOM) is a cross-platform and language-
independent convention for representing and interacting with objects in
HTML, XHTML and XML documents.

Objects in the DOM tree may be addressed and manipulated by using
methods on the objects.

The public interface of a DOM is specified in its application
programming interface (API).

The history of the Document Object Model is intertwined with the
history of the "browser wars" of the late 1990s between Netscape
Navigator and Microsoft Internet Explorer, as well as with that of
JavaScript and JScript, the first scripting languages to be widely
implemented in the layout engines of web browsers.
.
Hieararchy of objects in an example HTML DOM
DOM implementation

DOM supports navigation in any direction (e.g., parent and previous
sibling) and allows for arbitrary modifications, an implementation must
at least buffer the document that has been read so far (or some parsed
form of it).

Layout engineS:

Web browsers rely on layout engines to parse HTML into a DOM. Some
layout engines, such as Trident/MSHTML, are associated primarily or
exclusively with a particular browser, such as Internet Explorer.

Others, such as Blink, WebKit, and Gecko, JavaScript rendered in html
pages, collection of web pages shared by a number of browsers, such as
Google Chrome, Opera, Safari, and Firefox. The different layout
engines implement the DOM standards to varying degrees of
compliance.
Server Architecture
Thin server architecture-
A SPA moves logic from the server to the client.This results in the role of the web
server evolving into a pure data API or web service.
Thick stateful server architecture-
The server keeps the necessary state in memory of the client state of the page. In this way, when any request
hits the server (usually user actions), the server sends the appropriate HTML and/or JavaScript with the
concrete changes to bring the client to the new desired state (usually adding/deleting/updating a part of the
client DOM). At the same time, the state in server is updated. Most of the logic is executed on the server,
and HTML is usually also rendered on the server. In some ways, the server simulates a web browser,
receiving events and performing delta changes in server state which are automatically propagated to
client.
Thick stateless server architecture - the client page sends the necessary data of the current state to the
server, usually through AJAX requests. The server with this data is able to reconstruct in some way the
client state of the page part going to be modified and generate the necessary data or code, for instance as
JavaScript code, returned to the client to bring it to a new state, usually modifying the page DOM tree
according to the action which motivated the request.
This approach requires more data sent to server and may require more computational resources per request to
reconstruct partially or fully the client page state in server. At the same time, this approach is more easily
scalable because there is no per client page data kept in server and therefore AJAX requests can be
dispatched to different server nodes with no need of session data sharing or server affinity.
Challenges with the SPA model

Because the SPA is an evolution away from the stateless page-redraw
model that browsers were originally designed for, some new challenges
have emerged. Each of these problems has an effective solution with:
i. Client-side JavaScript libraries addressing various issues.
ii. Server side web frameworks that specialize in the SPA model.
iii. The evolution of browsers and the HTML5 specification aimed at the
SPA model.
A) SEARCH ENGINE OPTIMIZATION
B) BROWSER HISTORY
C) PAGE LIFE CYCLE
SEO

Because of the lack of JavaScript execution on crawlers of all popular
Web search engines, SEO (Search engine optimization) has historically
presented a problem for public facing websites wishing to adopt the SPA
model.

Google currently crawls URLs containing hash fragments starting with
#!,. This allows the use of hash fragments within the single URL of an
SPA.

Special behavior must be implemented by the SPA site to allow
extraction of relevant metadata by the search engine's crawler.

For search engines that do not support this URL hash scheme, the
hashed URLs of the SPA remain invisible.
Browser History

The model breaks the browser's design for page history navigation
using the Forward/Back buttons. This presents a usability impediment
when a user presses the back button, expecting the previous screen state
within the SPA, but instead the application's single page unloads and the
previous page in the browser's history is presented.

The traditional solution for SPA's has been to change the browser URL's
hash fragment identifier in accord with the current screen state. This can
be achieved with JavaScript, and causes URL history events to be built
up within the browser. As long as the SPA is capable of resurrecting the
same screen state from information contained within the URL hash, the
expected back button behavior is retained.
Page Lifecycle
An SPA is fully loaded in the initial page load and then page regions are replaced or updated
with new page fragments loaded from the server on demand.

To avoid excessive downloading of unused features, an SPA will often progressively download
more features as they become required, either small fragments of the page, or complete screen
modules.

In this way an analogy exists between "states" in an SPA and "pages" in a traditional web site.
Because "state navigation" in the same page is analogous to page navigation, in theory any page
based web site could be converted to single-page replacing in the same page only the changed
parts result of comparing consecutive pages in a non-SPA.

The SPA approach on the web is similar to the Single Document Interface (SDI) presentation
technique popular in native desktop applications.

Running locally:

Some SPAs may be executed from a local file using the file URI scheme. This gives users the
ability to download the SPA from a server and run the file from a local storage device, without
depending on server connectivity. If such an SPA wants to store and update data, it must use
browser-based Web Storage. These applications benefit from advances available with HTML5.

Contenu connexe

Tendances

Single Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.WebSingle Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.Web
Chris Canal
 

Tendances (20)

Single Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJSSingle Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJS
 
Single page App
Single page AppSingle page App
Single page App
 
Full stack devlopment using django main ppt
Full stack devlopment using django main pptFull stack devlopment using django main ppt
Full stack devlopment using django main ppt
 
Modern Web App Architectures
Modern Web App ArchitecturesModern Web App Architectures
Modern Web App Architectures
 
Single Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.WebSingle Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.Web
 
Chris O'Brien - Modern SharePoint sites and the SharePoint Framework - reference
Chris O'Brien - Modern SharePoint sites and the SharePoint Framework - referenceChris O'Brien - Modern SharePoint sites and the SharePoint Framework - reference
Chris O'Brien - Modern SharePoint sites and the SharePoint Framework - reference
 
SharePoint Framework - Developer Preview
SharePoint Framework - Developer PreviewSharePoint Framework - Developer Preview
SharePoint Framework - Developer Preview
 
Pros and Cons of developing a Thick Clientside App
Pros and Cons of developing a Thick Clientside AppPros and Cons of developing a Thick Clientside App
Pros and Cons of developing a Thick Clientside App
 
A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)
 
Single page applications
Single page applicationsSingle page applications
Single page applications
 
Rise and Fall of the Frontend Developer
Rise and Fall of the Frontend DeveloperRise and Fall of the Frontend Developer
Rise and Fall of the Frontend Developer
 
Back to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web DevelopmentBack to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web Development
 
A Gentle Introduction to Blazor
A Gentle Introduction to BlazorA Gentle Introduction to Blazor
A Gentle Introduction to Blazor
 
SGCE 2012 Lightning Talk-Single Page Interface
SGCE 2012 Lightning Talk-Single Page InterfaceSGCE 2012 Lightning Talk-Single Page Interface
SGCE 2012 Lightning Talk-Single Page Interface
 
Building productivity solutions with Microsoft Graph
Building productivity solutions with Microsoft GraphBuilding productivity solutions with Microsoft Graph
Building productivity solutions with Microsoft Graph
 
Learning Single page Application chapter 1
Learning Single page Application chapter 1Learning Single page Application chapter 1
Learning Single page Application chapter 1
 
Client side vs server side
Client side vs server sideClient side vs server side
Client side vs server side
 
Ajax Using JSP with prototype.js
Ajax Using JSP with prototype.jsAjax Using JSP with prototype.js
Ajax Using JSP with prototype.js
 
Refactoring to a Single Page Application
Refactoring to a Single Page ApplicationRefactoring to a Single Page Application
Refactoring to a Single Page Application
 
Deep-dive building solutions on the SharePoint Framework
Deep-dive building solutions on the SharePoint FrameworkDeep-dive building solutions on the SharePoint Framework
Deep-dive building solutions on the SharePoint Framework
 

En vedette

Single-Page Web Application Architecture
Single-Page Web Application ArchitectureSingle-Page Web Application Architecture
Single-Page Web Application Architecture
Eray Arslan
 

En vedette (20)

Angular 2 with TypeScript
Angular 2 with TypeScriptAngular 2 with TypeScript
Angular 2 with TypeScript
 
Rits Brown Bag - TypeScript
Rits Brown Bag - TypeScriptRits Brown Bag - TypeScript
Rits Brown Bag - TypeScript
 
The Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cliThe Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cli
 
Single-Page Web Application Architecture
Single-Page Web Application ArchitectureSingle-Page Web Application Architecture
Single-Page Web Application Architecture
 
Angular 2 + TypeScript = true. Let's Play!
Angular 2 + TypeScript = true. Let's Play!Angular 2 + TypeScript = true. Let's Play!
Angular 2 + TypeScript = true. Let's Play!
 
Angular 2 with TypeScript
Angular 2 with TypeScriptAngular 2 with TypeScript
Angular 2 with TypeScript
 
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 Minutes
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 MinutesUsing Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 Minutes
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 Minutes
 
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...
 
Single page application
Single page applicationSingle page application
Single page application
 
Angular 1.x vs 2 - In code level
Angular 1.x vs 2 - In code levelAngular 1.x vs 2 - In code level
Angular 1.x vs 2 - In code level
 
Single page application
Single page applicationSingle page application
Single page application
 
Getting started with Angular CLI
Getting started with Angular CLIGetting started with Angular CLI
Getting started with Angular CLI
 
02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
 
Getting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLIGetting Started with the Angular 2 CLI
Getting Started with the Angular 2 CLI
 
Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
 
An afternoon with angular 2
An afternoon with angular 2An afternoon with angular 2
An afternoon with angular 2
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Node js
Node jsNode js
Node js
 
Angular 2 vs Angular 1
Angular 2 vs Angular 1Angular 2 vs Angular 1
Angular 2 vs Angular 1
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 

Similaire à single page application

Web 2 0 Fullfeatures
Web 2 0 FullfeaturesWeb 2 0 Fullfeatures
Web 2 0 Fullfeatures
vsnmurthy
 
Web 2 0 Fullfeatures
Web 2 0 FullfeaturesWeb 2 0 Fullfeatures
Web 2 0 Fullfeatures
guest9b7f4753
 

Similaire à single page application (20)

Web 2 0 Tools
Web 2 0 ToolsWeb 2 0 Tools
Web 2 0 Tools
 
Single Page Application (SPA): A Comprehensive Guide for Beginners
Single Page Application (SPA): A Comprehensive Guide for BeginnersSingle Page Application (SPA): A Comprehensive Guide for Beginners
Single Page Application (SPA): A Comprehensive Guide for Beginners
 
Ajax
AjaxAjax
Ajax
 
technology@web
technology@webtechnology@web
technology@web
 
Components of a Generic Web Application Architecture
Components of  a Generic Web Application ArchitectureComponents of  a Generic Web Application Architecture
Components of a Generic Web Application Architecture
 
Overview of AJAX
Overview of AJAXOverview of AJAX
Overview of AJAX
 
Angular webinar - Credo Systemz
Angular webinar - Credo SystemzAngular webinar - Credo Systemz
Angular webinar - Credo Systemz
 
Single Page Application
Single Page ApplicationSingle Page Application
Single Page Application
 
AJAX
AJAXAJAX
AJAX
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
 
Ajax Ppt 1
Ajax Ppt 1Ajax Ppt 1
Ajax Ppt 1
 
Introduction To Website Development
Introduction To Website DevelopmentIntroduction To Website Development
Introduction To Website Development
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web Application
 
Component based User Interface Rendering with State Caching Between Routes
Component based User Interface Rendering with State Caching Between RoutesComponent based User Interface Rendering with State Caching Between Routes
Component based User Interface Rendering with State Caching Between Routes
 
Esc 209 paper_doin
Esc 209 paper_doinEsc 209 paper_doin
Esc 209 paper_doin
 
Web 2 0 Fullfeatures
Web 2 0 FullfeaturesWeb 2 0 Fullfeatures
Web 2 0 Fullfeatures
 
Web 2 0 Fullfeatures
Web 2 0 FullfeaturesWeb 2 0 Fullfeatures
Web 2 0 Fullfeatures
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Single page applications with backbone js
Single page applications with backbone jsSingle page applications with backbone js
Single page applications with backbone js
 

Dernier

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 

Dernier (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 

single page application

  • 1. S.P.A-SINGLE PAGE APPLICATION It's also single-page interface (SPI), is a web application or web site that fits on a single web page with the goal of providing a more fluid user experience akin(same) to a desktop application In a SPA, either all necessary code – HTML, JavaScript, and CSS – is retrieved with a single page load,or the appropriate resources are dynamically loaded and added to the page as necessary, usually in response to user actions.
  • 2. S.P.A The page does not reload at any point in the process, nor does control transfer to another page, although modern web technologies (such as those included in HTML5) can provide the perception and navigability of separate logical pages in the application. Interaction with the single page application often involves dynamic communication with the web server behind the scenes. The term single-page application was coined by Steve Yen in 2005,
  • 3. few distinct characteristics of the professional Single Page Application:  CHUNKING  CONTROLLERS  TEMPLATING  ROUTING  REAL-TIME COMMUNICATION  LOCAL STORAGE
  • 4.  CHUNKING-the web page is constructed by loading chunks of HTML fragments and JSON data instead of receiving full HTML from a web server on every request. (Backbone.js, pjax, jQuery, Upshot.js)  CONTROLLERS-JavaScript code that handles complex DOM and data manipulations, application logic and AJAX calls is replaced by controllers that separate views and models using MVC or MVVM patterns. (Backbone.js, Knockout.js, JavascriptMVC)  TEMPLATING-coding of UI and DOM manipulations are replaced by declarative binding of data to HTML templates. (Knockout.js, Mustache, jQuery Templates, Underscore.js)
  • 5.  Routing – selection of views and navigation (without page reloads) that preserves page state, elements and data (History.js, Crossroads.js, Backbone.js, pjax, HTML5 History API)  Real-time communication – two-way communication of a client application and web server replaces one-way requests from a browser (HTML5 Web Sockets, Socket.io, SignalR)  Local storage – capabilities of storing data on a browser for performance and offline access replace cookies and intensive data loads from web server (HTML5 Local storage).
  • 6. Javascript frameworks(angularjs)  AngularJS is a fully client-side library. AngularJS's templating is based on bidirectional data binding.  Data-binding is an automatic way of updating the view whenever the model changes, as well as updating the model whenever the view changes.  The html template is compiled in the browser. The compilation step creates pure html, upon which the browser re-renders into the live view. The step is repeated for subsequent page views.  In traditional server-side html programming, concepts such as controller and model interact within a server process to produce new html views.  In the AngularJS framework, the controller and model state are maintained within the client browser. Therefore new pages are generated without any interaction with a server.
  • 7.  Websockets:  WebSockets are a part of HTML5 spec and is used for single page apps  Browser plugins:  Asynchronous calls to the server may also be achieved using browser plug-in technologies such as Silverlight, Flash, or Java applets.  Data transport (XML, JSON and AJAX):  Requests to the server typically result in either raw data (e.g. XML or JSON), or new HTML being returned. In the case where HTML is returned by the server, JavaScript on the client updates a partial area of the DOM (Document Object Model). When raw data is returned, often a client-side JavaScript XML / (XSL) process ( and in case of JSON a template ) is used to translate the raw data into HTML, which is then used to update a partial area of the DOM.
  • 8. DOM  The Document Object Model (DOM) is a cross-platform and language- independent convention for representing and interacting with objects in HTML, XHTML and XML documents.  Objects in the DOM tree may be addressed and manipulated by using methods on the objects.  The public interface of a DOM is specified in its application programming interface (API).  The history of the Document Object Model is intertwined with the history of the "browser wars" of the late 1990s between Netscape Navigator and Microsoft Internet Explorer, as well as with that of JavaScript and JScript, the first scripting languages to be widely implemented in the layout engines of web browsers.
  • 9. . Hieararchy of objects in an example HTML DOM
  • 10. DOM implementation  DOM supports navigation in any direction (e.g., parent and previous sibling) and allows for arbitrary modifications, an implementation must at least buffer the document that has been read so far (or some parsed form of it).  Layout engineS:  Web browsers rely on layout engines to parse HTML into a DOM. Some layout engines, such as Trident/MSHTML, are associated primarily or exclusively with a particular browser, such as Internet Explorer.  Others, such as Blink, WebKit, and Gecko, JavaScript rendered in html pages, collection of web pages shared by a number of browsers, such as Google Chrome, Opera, Safari, and Firefox. The different layout engines implement the DOM standards to varying degrees of compliance.
  • 11. Server Architecture Thin server architecture- A SPA moves logic from the server to the client.This results in the role of the web server evolving into a pure data API or web service. Thick stateful server architecture- The server keeps the necessary state in memory of the client state of the page. In this way, when any request hits the server (usually user actions), the server sends the appropriate HTML and/or JavaScript with the concrete changes to bring the client to the new desired state (usually adding/deleting/updating a part of the client DOM). At the same time, the state in server is updated. Most of the logic is executed on the server, and HTML is usually also rendered on the server. In some ways, the server simulates a web browser, receiving events and performing delta changes in server state which are automatically propagated to client. Thick stateless server architecture - the client page sends the necessary data of the current state to the server, usually through AJAX requests. The server with this data is able to reconstruct in some way the client state of the page part going to be modified and generate the necessary data or code, for instance as JavaScript code, returned to the client to bring it to a new state, usually modifying the page DOM tree according to the action which motivated the request. This approach requires more data sent to server and may require more computational resources per request to reconstruct partially or fully the client page state in server. At the same time, this approach is more easily scalable because there is no per client page data kept in server and therefore AJAX requests can be dispatched to different server nodes with no need of session data sharing or server affinity.
  • 12. Challenges with the SPA model  Because the SPA is an evolution away from the stateless page-redraw model that browsers were originally designed for, some new challenges have emerged. Each of these problems has an effective solution with: i. Client-side JavaScript libraries addressing various issues. ii. Server side web frameworks that specialize in the SPA model. iii. The evolution of browsers and the HTML5 specification aimed at the SPA model. A) SEARCH ENGINE OPTIMIZATION B) BROWSER HISTORY C) PAGE LIFE CYCLE
  • 13. SEO  Because of the lack of JavaScript execution on crawlers of all popular Web search engines, SEO (Search engine optimization) has historically presented a problem for public facing websites wishing to adopt the SPA model.  Google currently crawls URLs containing hash fragments starting with #!,. This allows the use of hash fragments within the single URL of an SPA.  Special behavior must be implemented by the SPA site to allow extraction of relevant metadata by the search engine's crawler.  For search engines that do not support this URL hash scheme, the hashed URLs of the SPA remain invisible.
  • 14. Browser History  The model breaks the browser's design for page history navigation using the Forward/Back buttons. This presents a usability impediment when a user presses the back button, expecting the previous screen state within the SPA, but instead the application's single page unloads and the previous page in the browser's history is presented.  The traditional solution for SPA's has been to change the browser URL's hash fragment identifier in accord with the current screen state. This can be achieved with JavaScript, and causes URL history events to be built up within the browser. As long as the SPA is capable of resurrecting the same screen state from information contained within the URL hash, the expected back button behavior is retained.
  • 15. Page Lifecycle An SPA is fully loaded in the initial page load and then page regions are replaced or updated with new page fragments loaded from the server on demand.  To avoid excessive downloading of unused features, an SPA will often progressively download more features as they become required, either small fragments of the page, or complete screen modules.  In this way an analogy exists between "states" in an SPA and "pages" in a traditional web site. Because "state navigation" in the same page is analogous to page navigation, in theory any page based web site could be converted to single-page replacing in the same page only the changed parts result of comparing consecutive pages in a non-SPA.  The SPA approach on the web is similar to the Single Document Interface (SDI) presentation technique popular in native desktop applications.  Running locally:  Some SPAs may be executed from a local file using the file URI scheme. This gives users the ability to download the SPA from a server and run the file from a local storage device, without depending on server connectivity. If such an SPA wants to store and update data, it must use browser-based Web Storage. These applications benefit from advances available with HTML5.