Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use location.replace for URL changes to fix back-button problems.

By using location.replace instead of location.hash to update the URL a
new history entry is not created, so the back button will now behave
as the user expects an return to the page before the bookreader.

This should work for IE and Firefox, but apparantly may not for WebKit
based browsers, as location.replace behaves differently for them.  See
these reported WebKit bugs:

https://bugs.webkit.org/show_bug.cgi?id=20355
https://bugs.webkit.org/show_bug.cgi?id=20425
https://bugs.webkit.org/show_bug.cgi?id=22224

This fix (at least partially) addresses these GnuBook bugs:

https://bugs.launchpad.net/gnubook/+bug/300521
https://bugs.launchpad.net/gnubook/+bug/294281
https://bugs.launchpad.net/gnubook/+bug/272022
  • Loading branch information...
commit 7858770c9a3d34a7c7f86bd2b92a646e11d2b944 1 parent bb42179
@ato authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 GnuBook/GnuBook.js
View
4 GnuBook/GnuBook.js
@@ -222,7 +222,7 @@ GnuBook.prototype.drawLeafsOnePage = function() {
}
var firstLeafToDraw = leafsToDisplay[0];
- window.location.hash = firstLeafToDraw;
+ window.location.replace('#' + firstLeafToDraw);
this.firstIndex = firstLeafToDraw;
if ((0 != firstLeafToDraw) && (1 < this.reduce)) {
@@ -381,7 +381,7 @@ GnuBook.prototype.updatePageNumBox2UP = function() {
} else {
$("#GBpagenum").val('');
}
- window.location.hash = this.currentLeafL;
+ window.location.replace('#' + this.currentLeafL);
}
// loadLeafs()
Please sign in to comment.
Something went wrong with that request. Please try again.