mirror of https://github.com/kiwix/libkiwix.git
Handling of manual hash component change
This commit is contained in:
parent
4db443eca6
commit
e5f97d95b1
|
@ -35,9 +35,20 @@
|
|||
}
|
||||
|
||||
const cf = document.getElementById('content_iframe');
|
||||
cf.src = userUrl2IframeUrl(window.location.hash.slice(1));
|
||||
cf.height = window.visualViewport.height - cf.offsetTop - 4;
|
||||
|
||||
function handle_location_hash_change() {
|
||||
const hash = window.location.hash;
|
||||
const iframeContentUrl = userUrl2IframeUrl(hash.slice(1));
|
||||
console.log("handle_location_hash_change: " + hash);
|
||||
if ( iframeContentUrl != cf.contentWindow.location.pathname ) {
|
||||
cf.src = iframeContentUrl;
|
||||
}
|
||||
}
|
||||
|
||||
window.onhashchange = handle_location_hash_change;
|
||||
handle_location_hash_change();
|
||||
|
||||
function handle_content_url_change() {
|
||||
document.title = cf.contentDocument.title;
|
||||
const iframeContentUrl = cf.contentWindow.location.pathname;
|
||||
|
|
Loading…
Reference in New Issue