Skip to Main Content
Adding Ajax
book

Adding Ajax

by Shelley Powers
June 2007
Intermediate to advanced content levelIntermediate to advanced
400 pages
9h 52m
English
O'Reilly Media, Inc.
Content preview from Adding Ajax

Remembering Place

In the last of the slideshows, which contains "pages" of links to existing weblog posts, clicking one of the links loads that story into the browser. Well and good, but if you click one of the links, another page opens in the browser. When you're ready to go back to the list, depending on the browser, the "place" where you had left the original slideshow is lost, and the first page is opened. If you open another page by typing in a new URL, using a search engine toolbar, or clicking a link in the bookmarks list, when you attempt to use the Back button to return to the slideshow application, again, you'll lose your "place."

A second problem is associated with trying to create a permanent link to a specific page in the slideshow, for instance, if you want to link to the fifth page in the text slideshow, or link to the third photo. The most you can do, with the way the application is currently coded, is tell users to go to the first page and then click the Next button so many times. This really isn't a workable option. What we need is a way to remember place.

Remembering Place and Page Fragments

Remembering place and persisting place are two problems with Ajax slideshows or any other single-page application. The way around both of these challenges is through the use of the window.location object, and the use of a page fragment, called the hash. A page hash is a value that's tacked on to the end of a URL when a page fragment is accessed within a page. Page fragments are ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Ajax: The Definitive Guide

Ajax: The Definitive Guide

Anthony T. Holdener III
Ajax Design Patterns

Ajax Design Patterns

Michael Mahemoff
Web Development with JavaScript and Ajax Illuminated

Web Development with JavaScript and Ajax Illuminated

Richard Allen, Kai Qian, Lixin Tao, Xiang Fu

Publisher Resources

ISBN: 9780596529369Supplemental ContentErrata Page