User:Thron7/Single page application2

A single-page application (SPA) is a self-contained web application. In an SPA, all necessary code – HTML, JavaScript, and CSS – is retrieved with a single page load. During user interaction with the application, the page is not reloaded or control transfered to another page. Necessary updates to the page display may or may not involve interaction with a server. The term was coined by Steve Yen in 2005.

Traditional web applications involve page changes, where the browser is required to fetch a new page from the server, in order to advance the interaction of the user with the application. But page changes in the browser disrupt the user experience, since there is a perceivable transition from one page - which has to be unloaded -, to the next page - which has to be retrieved from the server and displayed from scratch. This often involves the unnecessary re-transmission and re-display of already existing und unchanged page elements (e.g. a navigation bar, or results from a database query), and suffers from the fact that network latencies cannot be hidden from the user.

Single page applications address these issues by requiring no page change of the browser during an application session. All user interaction and changes of the application state are handled in the context of a single Web document. The user experience becomes more continuous and fluid, and network latencies can be hidden more easily. There are various techniques available to allow the browser to stay with a single page even when the application requires server communication, the most prominent currently being Ajax techniques. Other possibilities to achieve a similar effect are browser plug-in technologies such as Java applets or Flash. Some SPAs may be executed from a local file using the file URI scheme. This gives users the ability to download the SPA from a server and run the file from a local storage device, without depending on server connectivity. If such a SPA wants to store and update data, it must be self-modifying. That is, the SPA must be capable of writing itself to disk, including a representation of the state that is to be persisted. Such applications benefit from advances available with HTML5, particularly Web Storage.

Currently, TiddlyWiki or Sudoku are known examples of an SPA.