From 09861ada2ce1bdc6ca1c567672500e74219c62b7 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Sat, 13 Dec 2014 23:19:04 -0800 Subject: [PATCH] wb.js: preserve anchor in location redirect update CHANGELIST --- CHANGES.rst | 2 ++ pywb/static/wb.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index b3b2bf6d..6a4f8439 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,8 @@ pywb 0.6.6 changelist ~~~~~~~~~~~~~~~~~~~~~ +* JS client side improvements: check for double-inits, preserve anchor in wb.js top location redirect + * JS Rewriters: add mixins for link + location (default), link only, location only rewriting by setting ``js_rewrite_location`` to ``all``, ``urls``, ``location``, respectively. (New: location only rewriting does not change JS urls) diff --git a/pywb/static/wb.js b/pywb/static/wb.js index 1974c59f..ea14c9fa 100644 --- a/pywb/static/wb.js +++ b/pywb/static/wb.js @@ -129,11 +129,13 @@ this.load = function() { if ((window.self == window.top) && wbinfo) { + var hash = window.location.hash; + var loc = window.location.href.replace(window.location.hash, ""); if (wbinfo.top_url && (loc != wbinfo.top_url) && wbinfo.mod != "bn_") { // Auto-redirect to top frame - window.location.replace(wbinfo.top_url); + window.location.replace(wbinfo.top_url + hash); } else { // Init Banner (no frame or top frame) add_event("readystatechange", init_banner, document);