Single page applications are applications which are heavily dependent on JavaScript.
With just one web page that we visit which then loads all other content using JavaScript. The best examples are Gmail and the new twitter.com
Single Page Application benefits:
- Thin Server Architecture
- Make application Snappy
- Rich Interface Application
- Web oriented Architecture
- Long lived Application
- No need to Laod the duplicate Code
- No Page full reload
- Single webpage that never needs to refresh or reload
- Providing a more fluid user experience akin to a desktop application.
- Data transport (JSON and AJAX):Requests to the server typically result in either raw data (JSON) or new HTML being returned. In the case where HTML is returned by the server, JavaScript on the client updates a partial area of the DOM (Document Object Model). When raw data is returned, oftentimes a client-side template is used to translate the raw data into HTML, which is then used to update a partial area of the DOM.
- Reduce load on your server.
- Give yourself more freedom.:When all ‘pages’ are accessible from one page you give yourself more freedom to manipulate the content of these ‘pages’ client-side. You can easily take content from one page and insert into another
Instead of navigating to separate URLs these applications tend to update the fragment hash (the bit after the #) - which retains bookmarkability and allows the back/forward buttons to continue to function.
The HTML5 history API makes it possible to create sites/applications that don't refresh the full page while still maintaining proper URLs.
Eg. GitHub When we click around in the repository browser with JS turned on and it updates via ajax (and updates the URL bar as well) .Also on visiting the same pages with JS turned off, we still get the correct content.
Example: Gmail, Googledoc, Twitter, Gaana.com....
Great
ReplyDeleteSingle Page Application Training