Chapter 9. Options and Efficiencies
Chapter 4’s discussion about Ajax’s effect on the browser back button
may seem like ancient history to you Ajax mavens. To refresh your memory,
a single-page Ajax application has a self-contained navigation model;
everything takes place in one web page, with client/server connections
occurring using XMLHttpRequest
. A user
who clicks the browser’s back button when the Ajax view changes in order
to return to the previous Ajax view is instead returned to the page that
preceded the Ajax application in that tab or window. This is a confusing
outcome for fans of the browser forward and back buttons. The first two
hacks in this chapter provide, well, hackish solutions to that
conundrum.
In this chapter, you’ll also find several hacks that use optional or alternative models to get their jobs done. These include a hack that uses declarative markup in XForms format instead of JavaScript to implement its tasks, another that sets up a search engine inside the browser, and a third that uses client-side JavaScript to cache the user’s data. The common theme in these hacks is design simplification and the reduction of server hits whenever possible.
This chapter includes some practical applications that are almost
“too pragmatic to be hacks.” One hack includes techniques for reducing the
size of and obfuscating[1] JavaScript code. Another uses string
s and array
s in script code to dynamically generate content. Still another uses Apache server configuration ...
Get Ajax Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.