Skip to content

Commit 24ba81e

Browse files
committed
Do not modify the History on direct links
When arriving at a page through a direct link, that page is already added to the browser's History. Thus, if we added it through history.pushState again, it'll be duplicate, and the browser's Back button no longer works.
1 parent 4becaae commit 24ba81e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

outline/manager.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,12 @@ module.exports = function (doc) {
16621662
UI.utils.getEyeFocus(tr, false, undefined, window) // instantly: false
16631663
}
16641664

1665-
if (solo && dom && dom.defaultView && dom.defaultView.history) {
1665+
if (
1666+
solo && dom && dom.defaultView && dom.defaultView.history
1667+
// Don't add the new location to the history if we arrived here through a direct link
1668+
// (i.e. when static/databrowser.html in node-solid-server called this method):
1669+
&& document.location.href !== subject.uri
1670+
) {
16661671
let stateObj = pane ? { paneName: pane.name } : {}
16671672
try { // can fail if different origin
16681673
dom.defaultView.history.pushState(stateObj, subject.uri, subject.uri)

0 commit comments

Comments
 (0)