[jQuery] history plugin in IE6 calls two links on using backbutton

[jQuery] history plugin in IE6 calls two links on using backbutton


I don't know if this is an error in the plugin or in my
implementation. (This plugin could use documentation on how it
functions)
Using plugin: http://plugins.jquery.com/project/issues/history
I have a program that creates a form divided into various pages. Each
page is denoted with a specific hash, except for the first, which has
no hash. I have set it up to move from page to page using either the
"back" or "continue" buttons on the pages, or using the forward and
back buttons of the browser. The "pages" will display one at a time,
without loading a new html page. This is all working perfectly in
FF2, but I'm having problems in IE6. I haven't bothered testing
beyond these two browsers yet.
When I go from page to page, my back history will be, for example
(most recent page on right):
"product"->"terms"->"shipping"->"billing"
and the currently displayed page is "payment". If I use the browser
back button to go back to "shipping", the back history should now be:
"product"->"terms"
which it is in FF2, but in IE6, the page displayed is "shipping", but
the back history is:
"product"->"terms"->"shipping"->"payment"
I don't know if this helps in debugging, but in the backbutton history
list, the last two items that should not be there. Instead of showing
the name of the html page, like the other history items, they show the
value of the title tag.
Here is the code that implements the hash history (two functions):
function buildHashManager() {
var hashVisit = {}, currentHash = "", nextHash="", currentPage,
nextPage;
for (var i in formthis.order) {
hashVisit[i] = false;
}
jQuery.history.init(pageLoad);
function pageLoad(hash) {
if (!hash || hashVisit[hash]) {
currentHash?currentPage = currentHash:currentPage =
formthis.order[0];
jQuery(formTag + " #" + currentPage).css
("display","none");
nextHash = hash;
nextHash?nextPage = nextHash:nextPage = formthis.order[0];
jQuery(formTag + " #" + nextPage).css("display","block");
if (formthis.status.use) {
formthis.status.update(formthis.order, nextPage);
}
currentHash = hash;
} else {
window.history.back();
}
};
return {
add : function (idval) {
if (idval!==formthis.order[0]) {
hashVisit[idval] = true;
}
},
remove : function (idval) {
if (idval!==formthis.order[0]) {
hashVisit[idval] = false;
}
}
}
}
next_button_event : function (formthis, formIdName, pageID,
nextPageID, nextBtnID, statusBar, copyField) {
jQuery(formIdName + " #" + pageID + " #" + nextBtnID).parents
("a").attr("href","#"+nextPageID).click(function (event) {
var errMessage;
if (pluggedIn.validate) {
errMessage = Validate.execute(formthis, formIdName, jQuery
(this).parents("form"));
};
var pageComp = formIdName + " #" + pageID;
if (copyField==pageComp && nextBtnID=="nextBtn" && !
copyToggleOff[formIdName]) {
if (pageID == "shipping") {
Events.copyaddress(formIdName, formIdName + "
#billing");
} else if (pageID == "billing") {
Events.copyaddress(formIdName, formIdName + "
#shipping");
}
};
if (!errMessage) {
formthis.hashManager.add(nextPageID);
var hash = this.href;
hash = hash.replace(/^.*#/, '');
jQuery.history.load(hash);
}
event.preventDefault();
});
},