mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Improved browsing history tracking & traversal
Before this fix, browsing history didn't work at all. Now it mostly works but there are still some quirks that must be debugged further. Since session history handling turns out to be a rather complex topic (see https://html.spec.whatwg.org/multipage/history.html) the work in that direction will be postponed until other features reach a comparable level of readiness.
This commit is contained in:
@ -42,7 +42,7 @@
|
||||
const iframeContentUrl = userUrl2IframeUrl(hash.slice(1));
|
||||
console.log("handle_location_hash_change: " + hash);
|
||||
if ( iframeContentUrl != cf.contentWindow.location.pathname ) {
|
||||
cf.src = iframeContentUrl;
|
||||
cf.contentWindow.location.replace(iframeContentUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,9 @@
|
||||
document.title = cf.contentDocument.title;
|
||||
const iframeContentUrl = cf.contentWindow.location.pathname;
|
||||
console.log('handle_content_url_change: ' + iframeContentUrl);
|
||||
window.location.hash = iframeUrl2UserUrl(iframeContentUrl);
|
||||
const newHash = '#' + iframeUrl2UserUrl(iframeContentUrl);
|
||||
const viewerURL = location.origin + location.pathname + location.search;
|
||||
window.location.replace(viewerURL + newHash);
|
||||
};
|
||||
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user