8250779: Anchor is ignored when reloading a page in Chrome
Reviewed-by: prappo
This commit is contained in:
parent
9798a0846b
commit
39892bf43f
@ -103,17 +103,17 @@ function indexFilesLoaded() {
|
||||
}
|
||||
|
||||
// Workaround for scroll position not being included in browser history (8249133)
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
document.addEventListener("DOMContentLoaded", function(e) {
|
||||
var contentDiv = document.querySelector("div.flex-content");
|
||||
window.onpopstate = function(e) {
|
||||
window.addEventListener("popstate", function(e) {
|
||||
if (e.state !== null) {
|
||||
contentDiv.scrollTop = e.state;
|
||||
}
|
||||
}
|
||||
window.onhashchange = function(e) {
|
||||
});
|
||||
window.addEventListener("hashchange", function(e) {
|
||||
history.replaceState(contentDiv.scrollTop, document.title);
|
||||
}
|
||||
contentDiv.onscroll = function(e) {
|
||||
});
|
||||
contentDiv.addEventListener("scroll", function(e) {
|
||||
var timeoutID;
|
||||
if (!timeoutID) {
|
||||
timeoutID = setTimeout(function() {
|
||||
@ -121,6 +121,8 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
timeoutID = null;
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
if (!location.hash) {
|
||||
history.replaceState(contentDiv.scrollTop, document.title);
|
||||
}
|
||||
history.replaceState(contentDiv.scrollTop, document.title);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user