Skip to content

Inconsistent Navigation History Behavior Across Browsers with Resource URLs Using tabs.update() #677

@mshibanami

Description

@mshibanami

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:

chrome.tabs.update(
    tabId,
    { chrome.runtime.getURL("test.html") });

When running the above code:

  • Firefox: Simply handles test.html like a normal web page. After navigating to test.html, the user can go back to the previous page.
  • Chrome: Also handles 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.
  • Safari: Deletes all previous pages from the history, not only the last page. Plus, it doesn't display the URL of 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.
firefox.mov
chrome.mov
safari.mov
And this is the code I actually used in the above demo.
// 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionNeeds further discussioninconsistencyInconsistent behavior across browsers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions