Singple Page Application


# Introduction

::: tip SPA (Single Page Application) is popular web application technology today. :::

  • SPA uses HTML and Ajax to give users have advanced experience. Each new page does not load entire content from server, it uses Ajax to get html, css of page and rewrite on the current page.

  • In SPA, all necessary code (HTML, JavaScript, CSS) is retrieved with a single page load, and the appropriate resources are dynamically loaded and render to the page, usually is response to user actions.

  • SPA opposed to Multiple Page Application (MPA) – traditional way that every change (render, display, request data, ..) will make requests to server.

# Compare between SPA and MPA

SPA MPA
Pros: Pros:
  • Fast
  • Develop simplified and streamlined
  • Cache effectively. Easy to pass data between pages and components
  • Easy to build multi flatform (native mobile or web app)
  • Good and easy for SEO
  • More sucure
Cons: Cons:
  • Difficult to make SEO
  • Less secure than MPA
  • Slow because every requests depend on server