ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
  AJAX: How to Handle Bookmarks and Back Buttons
Subject:   When one of your ajax pages contains real anchors...
Date:   2007-04-23 02:58:24
From:   funkydunc
Great solution! I'm currently implementing it on www.streamthru.com.

There is a problem though, if one of the pages you load with an ajax request contains real anchors. An example, from my site, is a faqs.html page that contains anchors #FAQ1, #FAQ2, #FAQ3 etc.

If you navigate to this page, then click on the anchors, when you navigate back, the historyChange function must reaload the faqs.html page when it detects the #FAQ1, #FAQ2, #FAQ3 entries.

This works fine in Firefox, but in IE 6 and 7 duplicate history entries seem to be created, so when the forward journey is faqs.html -> #FAQ1 -> #FAQ2 -> #FAQ3, the backward journey is #FAQ3 -> #FAQ2 -> #FAQ3 -> #FAQ2 -> #FAQ1 -> #FAQ2 -> #FAQ1 -> faqs.html

Has anyone found a solution to this? I'll post an update if I find one. Thanks. Duncan