A single-page application (SPA) changes what users see without repeatedly loading entirely new web pages. This lesson explains the basic model, its purpose, and how an SPA moves between views.
A single-page application (SPA) is a web application or website that responds to user actions by dynamically rewriting the current page with new data, rather than loading a complete new page for every transition. The browser initially loads the application’s core resources, such as HTML, JavaScript, and CSS. Other resources can be fetched and added as needed.
All flashcards
What is a single-page application (SPA)?
A web application that dynamically updates the current page instead of loading a complete new page for every transition.
What happens during an SPA’s initial load?
The browser loads the application shell and enough HTML, JavaScript, and CSS to start.
What is Ajax?
A way to exchange information asynchronously with a server without requiring a full-page reload.
What is imperative DOM manipulation?
An approach in which code specifies directly which elements in the page to change.
How does Svelte prepare components for the browser?
It compiles components into JavaScript DOM operations.
Quiz questions
Which communication channel supports bidirectional, real-time communication between a browser and a server?Answer: WebSockets support bidirectional, real-time communication.
What characterizes a thin-server architecture for an SPA?Answer: Most application logic runs on the client, while the server mainly provides an API.
How can an SPA update browser history without loading a full page?Answer: It can use History API methods such as pushState and replaceState.
Which approaches are recommended for making SPA content available to search crawlers?Answer: Server-side rendering, static rendering, or hydration.
Why can dynamic application security testing tools have difficulty exploring some SPAs?Answer: They may need to navigate client-side flows and discover API requests that ordinary links do not expose.