DEV Community

Abhi Jain
Abhi Jain

Posted on

Single Page Application

A single-page app is the kind of web app that interacts with the user by dynamically rewriting new data from the server on the current page.
The goal of such an application is the faster transition and provide a feel like a native app to the website.

single page application

History
The concept of such an application was discussed in early 2003 by a programming student at Cardiff University.

Approach to build SPA
Ajax: It is one of the most famous techniques. It involves an asynchronous request to the server for data. With ajax, the website directly uses javascript or javascript library to manipulate dom.
Web-sockets: For real-time communication, their use is superior to ajax. It is real-time bi-directional communication technology.
Javascript frameworks: A lot of web browser javascript frameworks and libraries have adopted SPA principles. Meteor.js is a full-stack javascript framework designed exclusively for SPA. Some other frameworks and libraries are React, Vue.js, Svelte, Knockout.js, Angular.js, Ember.js, Ext.js etc.

Challenges
Browser History: the model breaks the browser's design for page history navigation using back and forward buttons.
Analytics: Tools such as google analytics rely heavily on new pages loading on the browser. In SPA, after the first page load, all page changes are handled by the application internally. Therefore, analytics fail to record stuff after the page load.

Top comments (0)