Skip to content

Commit 09861ad

Browse files
committed
wb.js: preserve anchor in location redirect
update CHANGELIST
1 parent 80c5b45 commit 09861ad

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
pywb 0.6.6 changelist
22
~~~~~~~~~~~~~~~~~~~~~
33

4+
* JS client side improvements: check for double-inits, preserve anchor in wb.js top location redirect
5+
46
* JS Rewriters: add mixins for link + location (default), link only, location only rewriting by setting ``js_rewrite_location`` to ``all``, ``urls``, ``location``, respectively.
57

68
(New: location only rewriting does not change JS urls)

pywb/static/wb.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,13 @@ this.load = function() {
129129

130130
if ((window.self == window.top) && wbinfo) {
131131

132+
var hash = window.location.hash;
133+
132134
var loc = window.location.href.replace(window.location.hash, "");
133135

134136
if (wbinfo.top_url && (loc != wbinfo.top_url) && wbinfo.mod != "bn_") {
135137
// Auto-redirect to top frame
136-
window.location.replace(wbinfo.top_url);
138+
window.location.replace(wbinfo.top_url + hash);
137139
} else {
138140
// Init Banner (no frame or top frame)
139141
add_event("readystatechange", init_banner, document);

0 commit comments

Comments
 (0)