HTML and CSS Reference
In-Depth Information
The Browser as a Platform
To some, server-side UI frameworks, which automatically generate JavaScript, CSS, and
HTML, are the saviors of enterprise development. To others, those UI frameworks create
a massive bottleneck and tie you to stale ideas and structures.
Today, developers are forced to look at web application architecture from a different
perspective where the browser and JavaScript are taking just as much spotlight as server-
side code (or in some cases, JavaScript is the server-side code).
Client Versus Server HTML Generation
Somewhere between 2008 and 2009, the server-heavy culture of generating HTML and
other resources on the backend broke down. This was mostly due to the progressive
enhancement of web pages with AJAX and other performance optimizations. This way
of thinking forced developers to create better APIs and more efficient ways of delivering
data to web applications through JSON and XML.
Generating HTML on the client reduces server load and can deliver a better overall user
experience. JSON and XML use less bandwidth than presentation-ready HTML, and
there is less string concatenation and HTML escaping to perform. The client browser
must download the first payload of JavaScript and markup, but after that, it's much easier
to control how resources are delivered and how the application is enhanced. This also
gives you the flexibility of using CDN bandwidth for such popular libraries as jQuery.
When using a CDN for resource delivery, you are betting that the user has already
downloaded this library through another website using the same CDN. This spares users
the bulk and expense of downloading a 33K (gzipped) library like jQuery yet again.
When everything runs on the client, however, performance is reduced. Parsing JSON
or XML and generating HTML uses more memory and processing time than just print‐
ing some server-rendered HTML.
Whether you are generating HTML on the client or the server, there are pros and cons
to each approach.
The client-side approach offers these benefits:
• Better user experience
• Network bandwidth reduction (decreases cost)
• Portability (offline capable)
The most notable client-side con is security. When you create an offline-capable appli‐
cation that is distributed across many different browsers, WebStorage ( localStorage )
is the only viable means for storing data on the client—and it offers no security.
Search WWH ::




Custom Search