Single Page Application and why is it becoming more and more popular

One of the key trends becoming more and more popular is the Single Page Application Framework and building applications that behave as native applications running on the machine.

SPA’s have been tried and tested for a while now and with libraries like Knockout.js, Backbone.js becoming more and more capable, it becomes feasible to create SPA’s.

What is an SPA?

I can describe in length but falling in line with DRY principle, here is the Wiki Link http://en.wikipedia.org/wiki/Single-page_application

But in short, it is a framework that builds highly responsive web applications that don’t infuse post backs and page reload. 

I can almost hear you say.

“Wait!! Isn’t that what AJAX and XMLHttpRequest promised?”

“Can’t I do it with Iframe?”

Hence this post, “Why SPA” now

Traditional web developers have tried using a variety of means to do this Single Page Application using Iframes, XMLHttpRequest, AJAX, jQuery and a variety of libraries.  There are caveats to each of these approaches.

First major issue with Iframes is the ability to communicate between the parent and the iframe.  80% of questions about Iframe in various forums (including my most popular blogpost on iframe) are about communication between the page in iframe and the parent.

The next with respect to asynchronous call backs is that, the URL doesn’t get updated and this causes 2 issues

1. There aren’t much URLs and hence the website isn’t search engine friendly

2. Users press the “Back” button and get an unexpected behaviour since the browser history is not updated and hence takes them to different locations instead of the previous stage.

How Single Page Application solves these issues?

Single Page Applications use a parameterized URL which defines various operations that you do.  For example, it may append an action to the base URL as below

http://localhost:2015/Task/?editItem=added5

Secondly, SPAs use history.js library (native.history.js) for maintaining the state of the page, so even though all the operations happen quickly and on the client side, the browser’s back button behaves normally and the page state is saved.

In addition to solving the above problems, SPA’s use a combination of template binding scripts, Data Model Scripts, Services and Data Templates making it all the more richer in functionality, to build.

Finally, SPAs integrate well with the new HTML5 features such as LocalStorage and Application Cache for building Offline Web Applications and make it easy to build apps that behave the same when not connected.

What does Microsoft have for developers?

In MVC4 Beta, there is Single Page Application Template that allows you to build SPAs with minimal effort.  The default template comes with all the required libraries wired up and a sample ToDoItem.cs file which is the model for data.  Upon building the solution and creating a TasksController which is based on the ToDoItem Model, one can navigate to the base URL + Tasks to experience creating /editing Tasks all of it in a Single Page Experience, both quick and elegant.

And since this post has been all talk and no technical tip, here below is one.

The Default SPA Template that comes up when you create a “File – New – ASP.NET MVC 4 Web Application – Single Page Application” Project which was released along with VS11 Beta is a bit out dated now.

Once the SPA Template Project is created, we need to run the NuGet command line utility (Tools – Package Manager Console) and type Install-Package SinglePageApplication.CSharp

This gives a much improved SPA Template to work with as outlined by Steve Sanderon himself, in his blog post.

Cheers !!!

Print | posted on Friday, April 20, 2012 12:14 AM

Comments on this post

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
I think you missed one of the biggest benefits of SPAs is that they provide a gateway to creating real applications. If you leverage frameworks like PhoneGap or even WinJS in Windows 8, SPAs provide the most effecient way of supporting both a web site and an application.
Left by Joe on Apr 20, 2012 1:31 AM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
This is good update that you have been shared to us in here. In fact, it is very useful to me. pmp certification
Left by Kristin Williams on Apr 20, 2012 5:11 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
I was very pleased to find this web-site.I wanted to thanks for your time for this wonderful read!!
<h1>No No Hair</h1>
Left by nicolapatric on Apr 21, 2012 2:27 AM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Thanks a lot for the wonderful post, Harish! It solves almost all my doubts. All that remains now id working on it :-)
Left by Ramakrishnan RS on Apr 21, 2012 6:06 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
I will be definitely interested in this update. Thank you so much. web designing bangalore
Left by William on May 15, 2012 3:48 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Yeah, it is famous because it allows solving some issues. Thank you for this information that you have shared. pmp online exam
Left by Honey Parker on May 21, 2012 11:39 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Excellent point; it’s the truth what you are telling us about; thanks so much for the wonderful article. bestech dharuhera
Left by shopia on Jun 13, 2012 11:49 AM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Fall into the serene beauty of the resorts in wayanad and relish.
Left by resorts in wayanad on Jul 07, 2012 10:08 AM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
it is because people dont need to travel to deep to get the information. but the problem with single page is the size, and load time. laser microfabrication
Left by Mike on Jul 25, 2012 9:52 AM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
It sure helped me a lot as well.This is not an easy topic, but you make it easy to be understood.thank you so much!
Left by Send Gift to karachi on Sep 14, 2012 3:52 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Thanks for the post, really amazing stuff. Can you post more information like this? This was really helpful to me!
Left by tvantennainstallations on Sep 17, 2012 10:08 AM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
I wanted to thank you for this special read.I have also bookmarked you for checking out new posts..!
Left by thailand holiday packages on Oct 16, 2012 9:20 AM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
I am interested and I see that any efforts and work that give any kind of help and useful information to people anywhere must be thanked and respected efforts.
torrent downloads
Left by torrent downloads on Oct 26, 2012 2:52 PM

# Polceam ten artykuł

Requesting Gravatar...
Pięknie napisane słowa , życzę wszystkim wszystkiego najlepszego!
Left by Ogniwa fotowoltaiczne on Nov 02, 2012 9:05 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
This is my first time I visit here. I found so many interesting stuffs in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work.
Left by Dell Motherboards on Nov 03, 2012 6:45 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Thanks, been looking into SPAs and this was very useful.
Left by Lottery Experiment on Nov 08, 2012 3:14 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
After all, while the other half were assigned to traditional community intervention programs that included some special-education programs at schools. After about two year
Left by Beats by dr dre on Nov 29, 2012 5:45 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
We tried some of this for our Application project and it worked great. Thanks for your insight.
Left by Markus on Dec 01, 2012 5:41 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
That's very halpful! Thanks a lot! Everything is clear now!
Left by Beethoven on Dec 03, 2012 2:30 AM

# penny auctions

Requesting Gravatar...
All thanks will be goes to you, because, you published a nice informative blog post. i have read this post. i want to tell you just keep it up. online penny auctions sites
Left by Lowfingaja baba on Dec 03, 2012 10:09 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Not satisfied with the small blacksmith murmured. Liu Taiyang step intruder turned over the eyelids said: "What now? Not you say to a pull fire?" "Did not want him to pull the fire!
Left by Beats By Dre Australia on Dec 12, 2012 12:01 PM

# Mrs

Requesting Gravatar...
You have made some excellent points there. Used to do they’re certified inside subject and barely found any specific info other websites, but great buy pendant necklace in order to be here, seriously, thanks.
Left by Ganja Sober on Jan 23, 2013 9:59 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
That's absolutely interesting for me and I do agree with the thoughts shared here on comments.rent to own mississauga Great..
Left by Alan on Feb 13, 2013 6:10 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
I wish I can go to all of these places right now. Putting them on my list when I visit! Can't wait. seo executive
Left by Sohanq on Feb 19, 2013 8:59 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
any interesting stuffs in your blog especially its discussion. From the tons o
Left by bag manufacturer on Feb 24, 2013 6:08 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
amazing news dudeThank buyers being transmit ideal nice informations. Your New web is greatI am impressed by The advice that you allow at things like this blog. this displays Techniques to excellent end users understand your nice. saved this page, will come back being significantly more. end users, my mate, ROCK! I discovered just the instructions I now searched all over the place as well as only couldn't find. What a OK website. like this this web site Ones web site is a of my new favs.I liking this info shown and this has now given me A few kind on desire how to succeed as A few argument, abundantly keep build up The effective the office
Left by Bookmark It on Feb 28, 2013 6:12 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Thanks a lot for the wonderful post, Harish! It solves almost all my doubts. All that remains now id working on it :-) http://www.seattlepi.com/business/press-releases/article/Top-7-Brands-of-Latex-Mattresses-Reviewed-by-4280144.php
Left by adf on Apr 02, 2013 1:31 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
thank you, i've just learn about Single Page App (SPA) in my school. :) it's hard but interesting. :)
Left by Cerita Lucu on Apr 07, 2013 10:20 AM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Keep this page strong and maintain it properly so that this would be last long and I can read comments and information here.
Left by bagmanufacturer on Apr 11, 2013 9:15 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
good complement to any outfit and is also amid the market's most trendy hats. Grown up men and females from all much more compared to planet depend
Left by drpciv on Apr 20, 2013 6:30 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Thank you. Good information...
Left by Mihai Drpciv on May 17, 2013 12:38 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Keep this page strong and maintain it properly so that this would be last long and I can read comments and information here. grosir jilbab paris bordir uniK
Left by kualsis on Jul 11, 2013 6:26 AM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
If you want to read good and informatics butcher supplies blog, then read this one because its information is understandable and effective. A large number of visitors come on this blog for getting rich information.

Left by Food Saver on Aug 22, 2013 4:54 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...

If you want to read good and informatics butcher supplies blog, then read this one because its information is understandable and effective. A large number of visitors come on this blog for getting rich information.
why the puppy bark
Left by BarkCollar on Sep 04, 2013 3:35 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
We tried some of this for our Application project and it dompet kulit pria worked great. Thanks for your insight.
Left by kalutrer on Sep 05, 2013 2:07 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Hi, Nice post. Its easy to get confused when everyone is going gaga on how single page apps would bring a shift in web design.

In my quest to learn more about the SPA, I have registered for a webinar on Benefits of developing Single Page Web Applications using AngularJS, it looks a promising one http://j.mp/1a9aK6t
Left by sushant on Nov 12, 2013 3:45 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Automation of system saves allot of our time. People usually now more relying on technology they even connect their appliances with smart phones.
apps for your kitchen! french door refrigerator
Left by Erric on Nov 27, 2013 3:00 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...

<head>
<meta http-equiv="Content-Language" content="en-us">
</head>

<p>thnksa ... </p>
<p>&nbsp;</p>
<p>good - post newz</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
Left by saeed2212 on Jan 23, 2014 2:48 AM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Why not jut build a client server app, with the browser as the SDI window?
Left by Phil on Mar 05, 2014 7:52 PM

# re: Single Page Application and why is it becoming more and more popular

Requesting Gravatar...
Trends come and go, although from personal experience I find that there is some positivity to extract from them. I'm new to the development field, but I'm learning more and more.
Left by Uchenna on May 01, 2014 5:26 PM

Your comment:

 (will show your gravatar)