WebPages are traditionally meant to be interactive to a User. Simply put, a User will submit a Request, or will perform an Action, and the Page will get updated accordingly. The User will again perform an Action, and the Page will be updated again.
But this had a few fundamental problems :-
1) Every Request was sent to the Server and hence the process was very slow for the User.
2) If a User made a mistake, this meant, he/she had to repeat the whole process again. Not a very good User Experience. Even if the Server handled this, the process, again, was very slow, and sometimes, pretty irritating.
3) Because only Server was capable of ‘changing’ the page, all overhead was at Server-level. So, even if a small part of the whole page needed to be updated, the whole page still needed to be generated by the Server. Hence, not a very Flexible and Scalable Product, and wastage of Server Resources.
The idea was simple, move page updates, which really didn’t need Server interaction, or limited update to the page, to be moved to the Browsers. This would mean faster WebPages, and less load on Servers. A win-win for all.
All “Executable Code” is added to the message queue, and gets executed when its turn comes. Again, more on this in later parts.