Closed mshibanami closed 2 months ago
The behavior described for Chromium matches that engine's general handling of navigations. This behavior is described as a history manipulation intervention and was introduced in 2019. To the best of my knowledge other engines have not implemented this.
EDIT: In today's meeting @Rob--W noted that Firefox also has some history manipulation intervention.
EDIT: In today's meeting @Rob--W noted that Firefox also has some history manipulation intervention.
FYI in Firefox it was implemented in https://bugzilla.mozilla.org/show_bug.cgi?id=1515073, with follow-ups in https://bugzilla.mozilla.org/show_bug.cgi?id=1645211
On Firefox's side, our preference is to keep Firefox's current behavior and to allow extensions to replace history entries with the loadReplace
option, as suggested in:
According to @xeenon , the disappearance of history items in Safari is a bug.
(see meeting notes for more discussion, pending review in #681).
Thanks! We’re tracking this as a Safari bug rather than a WebKit issue. Bug reference: 134939755
Thanks for the responses! I now understand the differences in browser behavior, and it's good to know related issues are being addressed. I'll close this discussion. Appreciate the help!
The following code handles navigation history differently across Firefox, Chrome, and Safari, and I'd like to know the expected behavior or whether we have a chance to define the expectation:
When running the above code:
test.html
like a normal web page. After navigating totest.html
, the user can go back to the previous page.test.html
like a normal web page but removes the previous page from the history if the user hasn't interacted with the previous pages since the tab was created.test.html
in the address bar.Which one is expected? Or do we have a chance to standardize the behavior across browsers, especially regarding the navigation history?
Demo
This is the demo of creating a new tab with example.com and then opening test.html bundled into the extension.
https://github.com/user-attachments/assets/bbb3a5ce-768f-4fb6-8f5a-810cba25517f https://github.com/user-attachments/assets/a9e50a7d-19fd-4cde-85db-13d296c1368e https://github.com/user-attachments/assets/4e194c1a-051e-4898-af34-1fb7f4202200And this is the code I actually used in the above demo.
```js // Safari and Firefox chrome.tabs.create({ url: "https://example.com" }) .then(tab => { const tabId = tab.id; setTimeout(() => { let url = chrome.runtime.getURL("test.html"); chrome.tabs.update( tabId, { url }); }, 1000); }); // Chrome chrome.tabs.create( { url: "https://example.com" }, (tab) => { setTimeout(() => { let url = chrome.runtime.getURL("test.html"); chrome.tabs.update( tab.id, { url }); }, 3000); }); ```A use case
My Safari extension has a feature of redirecting to another app. Specifically, when the user tries to open a web page, the extension first navigates to a loading page bundled into the extension, and then the extension opens another app by running a native CLI command. However, opening the loading page causes Safari to delete the navigation history, preventing the user from returning to the previous web pages. Yesterday, I received user feedback about this issue and realized that Firefox's way would work ideally for my extension. Therefore, I hope the browsers will be aligned with what Firefox does.