Single Page Vs Multi Page Application.

Sameer Abrar Khan
5 min readJan 8, 2021

Introduction

Single page application is a type of web application or website that uses a single HTML page as a shell for all web-pages. SPAs have a dynamic nature of loading. During interaction with a user, they display content without the need to be fully updated since different pieces of content are downloaded automatically as per request. It is possible thanks to AJAX technology. No matter what you click there, most links will not trigger a page reload. In single-page applications, there is only one HTML page and this one page downloads a bunch of assets, CSS, images but typically also a lot of JavaScript. Speaking of the latter, the code will then listen to clicks on links and then re-render parts of the DOM in the loaded page whenever a user needs something.

Multi page application is a web application that consists of multiple web pages that are downloaded when a user visits different parts of the page. This is a traditional web app development pattern suitable for websites that have to deal with big amounts of content.

Let’s take, for instance, a website of The New York Times. It is a good example of a multi-page application. How can we see it? Just click any article and watch the reload icon on the top of your browser. You see that reloading has started because a browser is now reaching out to the server of The New York Times and fetching that article and all the resources needed. Resources would be images and JavaScript or CSS and so on. The interesting thing about multi-page applications is that every new page a user fetches is downloaded. Every request we send to the server, like whenever we type a new URL or click on a link, leads to a new page being sent back from the server. Other great examples of multiple page applications are giants like Amazon or eBay. Using them, you always get a new file for every request.

As a rule, multi-page apps are complex with quite a few levels, links, and different UIs. The content on such websites is broken down into multiple micro-websites, sections, and subsections.

SPA Pros

  • Responsiveness and High Speed

Comparing to traditional web apps, SPAs are much faster since they don’t require the entire page reload. The logic is executed within a browser which adds up to the speed of a website significantly. After the initial page load, only separate items of data will be reloaded by the request of the user. The improved user experience is something single-page web apps can boast of. As we all know, the page load speed plays a vital role in whether or not users will stay on a website. People are impatient and if the page loading takes more than 3 seconds, chances are, they will abandon this website and look for another one.

  • Offline Opportunities (Caching)

One of the advantages of single-page web apps is their capability of caching any local data. In such apps, only one request is sent to a server and then all data the app receives is stored in it. Thanks to this SPAs can work offline. Even if a user loses the Internet connection, they still will be able to use the loaded data in an SPA.

  • Mobile Adaptability

When the necessity to create a mobile app pops up, it is a lot easier to make it happen with single-page apps. Frameworks that developers work with while developing SPAs provide them with an opportunity to reuse code elements for a mobile version of an app. Besides, the design of single-page web apps resembles the desktop or mobile apps therefore there’s little work with adjusting it for mobile devices.

  • Decoupled frontend

This means that there’s no need in writing any server-side code. In development teams, there are specialists who focus on the backend and they will create an API to which it will be possible to reach out from a single-page app. The decoupled frontend makes it much easier to work.

MPA Pros

  • SEO

Search engine optimization is a big advantage here. SEO is generally simple and easy. Since there is a brand new page that already holds the finished content for every request, the user sees what the crawler sees, and therefore crawlers fetch what is on the page.

  • Great Scalability

It won’t be an exaggeration to say that multi-page applications have great scalability. This means that no matter how much content you need your application to include, there will be no limits. MPAs allow adding an unlimited number of new features, product pages, information about services, and so on.

  • A big number of existing frameworks and solutions

Even today the majority of the web pages are multi-page applications hence there are a lot of best practices, approaches, tutorials, frameworks which allow developers to create advanced multi-page apps.

SPA Cons

  • SEO

Search engine optimization can be quite challenging. Although things have been improved during the last couple of years, it still takes some advanced knowledge to make single-page applications super SEO-friendly. Why? Because crawlers like the Googlebot can parse JavaScript, but they have big problems if the content is being loaded asynchronously. After the initial page loading is done, the crawler doesn’t know there is more data to arrive and so at this point SEO is missed.

  • Troubles with Security

When comparing single-page application vs multi-page application, it is safe to say that the first one is more vulnerable to cross-site scripting attacks. Due to XSS, hackers are able to insert their own client-side script into web apps. However, it can be prevented by the means of securing data endpoints.

MPA Cons

  • Lower Speed

MPAs are slower than SPAs since they constantly need to load new pages for every request and wait for that to happen. And if a server is slow, the application will be slow too. The fact that a browser needs to reload all resources and page data every time a user visits new pages results in a slower speed and leads to worse user experience.

  • Development time

When it comes to multi-page applications the frontend and backend are more tightly coupled, therefore developers need more time to build them. There’s typically one project that requires the frontend and backend code to be written from scratch.

Conclusion

When SPAs have an upper hand

Single-page applications are the perfect match if you need to create a dynamic solution with a limited data volume. Even though they run in the browser, single-page apps feel like desktop or mobile apps and that’s why they are so popular. Since single-page architecture has highly reactive behavior, it is ideal for building platforms like social networking sites, SaaS platforms, and closed communities where SEO has little influence.

When MPAs have an upper hand

In turn, MAPs will be a win-win option for large-scale companies that need to present a wide array of services and products and therefore the app will require quite a few features, pages, and menus. For example, if you need to create an online store or build a marketplace like eBay, a multi-page app is the way to go.

As you can see it is not about deciding whether a single-page app is better than a multi-page app or vice versa since both architectures have their own benefits and drawbacks. It is about picking what solution is more suitable for particular business needs. If you have any questions regarding this topic, feel free to reach out to us. We will happily help you with choosing the best web app for your business.

--

--

Sameer Abrar Khan
0 Followers

Experienced mobile app developer who has a track record of successfully creating apps that are both well-received and commercially viable.