Chapter 9. Options and Efficiencies


Hacks 6880

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 strings and arrays in script code to dynamically generate content. Still another uses Apache server configuration to deal with Ajax's restrictions on cross-domain requests.

[1] This term refers to reformatting the code so that the JavaScript is very difficult to read for anyone who tries to reverse-engineer it, but the running program is not affected.




Ajax Hacks
Ajax Hacks: Tips & Tools for Creating Responsive Web Sites
ISBN: 0596101694
EAN: 2147483647
Year: 2006
Pages: 138

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net