Single Page Applications
Single Page Applications
Chapter 5
One single link to the entire app, however, deep linking allows
Link sharing A separate link for every page of the MPA
linking to a specific piece of content
• Initial load times: Although SPAs are praised for showcasing great
performance and speed, it takes a while to load the complete site. It may
irritate some users who may not open the app again.
Cons of the Single Page Application (2):
• Online threats: SPAs are more vulnerable to online threats such as cross-
site scripting (XSS) than MPAs. Attackers can utilize XSS to inject client
side scripts into a web app and compromise it. In addition, access control is
not tight at the operational level. It can expose sensitive data and functions
if the developers don’t take precautions.
• Browser history: SPAs don’t store browser history. If you check the
history for any valuable data, you only see the SPA’s link to the entire
website. Also, you can’t move back and forth in the SPA. However, this
drawback can be neutralized by using the HTML5 History API.
When should you use SPAs? (1)
• SPAs come with a lot of benefits but also drawbacks, as you saw in the
previous section. So, it’s not wise to say that it’s entirely good or bad. It
depends upon your requirements and goals to create an application.
• If you want to build a website with smaller data volumes and a dynamic
platform, you can use single-page applications.
• It’s also fruitful if you plan to build a mobile application in the future, you
can use the backend API for both your site and mobile app.
• Choose SPAs if you want to offer a native-like, consistent, and dynamic
user experience across different operating systems, browsers, and devices.
When should you use SPAs?
• SPAs architecture is also suitable to build social networks (for instance,
Facebook), closed communities, and SaaS platforms as they don’t need
much SEO.
• If you wish to offer a seamless user interaction in your application, go for a
SPA. Single Page Apps like Google Maps use this approach to provide live
changes when users move from one place to another.
• SPAs are also great if you want to offer live updates on your application for
purposes like data streaming, real-time charts, notifications, alerts, etc.