Closed Bug 1878318 Opened 2 years ago Closed 2 years ago

window.open doesn't respect background tab preference

Categories

(Firefox :: Tabbed Browser, defect)

Firefox 122
defect

Tracking

()

RESOLVED DUPLICATE of bug 1081542

People

(Reporter: firefox, Unassigned)

Details

Attachments

(1 file)

Attached file index.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3 Safari/605.1.15

Steps to reproduce:

  1. In Firefox General preferences, uncheck "When you open a link, image or media in a new tab, switch to it immediately"
  2. Open the attached sample HTML file "index.html"
  3. Command-click on the "window.open" link

Actual results:

The link opens in the foreground.

Expected results:

The link opens in the background.

The example works as expected in Chrome and Safari.

Below is the relevant HTML/JavaScript:

<p><a href="https://example.org" id="example">window.open</a></p>

<script>
document.getElementById("example").addEventListener("click", (event) => {
event.preventDefault();
const newWindow = window.open("", "_blank");
if (newWindow)
newWindow.location = "https://example.org";
});
</script>

Component: Untriaged → Tabbed Browser
See Also: → 1081542
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1081542
Resolution: --- → DUPLICATE
See Also: 1081542
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: