lapcat / SafariExtensions

Resources for the development of Safari extensions
43 stars 3 forks source link

FB11958284 - target="_blank" and command-click don't work in extension pages #35

Open lapcat opened 1 year ago

lapcat commented 1 year ago

Safari 16.2 (17614.3.7.1.7, 17614) on macOS 12.6.2 (21G320)

target="_blank" and command-click don't work in extension pages. They open links in the same tab rather than in a new tab. The attached sample project uses an extension preference page, but this happens in any extension page, such as one opened by runtime.getURL() and tabs.create().

Steps to reproduce:

  1. Unzip, open, build, and run the attached sample Xcode project TargetBlankBug
  2. Enable the extension in Safari Extensions Preferences
  3. Click the Preferences button in Safari Extensions Preferences to open the extension preferences in a tab
  4. Click on the target="_blank" link, or command-click on it

Expected results: The link opens in a new tab.

Actual results: The link opens in the same tab.

TargetBlankBug.zip Strangely, this bug only occurs on Mac. target="_blank" works correctly in Mobile Safari.