Open an about:blank tab in a Safari App Extension

Hi,


I've been working on a Safari App Extension recently where I want to be able to open a new tab or window with an empty page similar to what the preferences in Safari allows me to do.


Unfortunately, using "about:blank" as the URL (as shown in the example below) results in a "Safari Can't Open the Page" error message despite the fact that it works as expected if I write it in the location bar in the browser.


window?.openTab(
  with: URL("about:blank"),
  makeActiveIfPossible: active,
  completionHandler: nil
)


How would I go about solving this issue?

I don't know if you can open a blank tab :/


Hopefully someone with more knowledge can reply, but I believe the openTab method has the same restrictions as the openWindow method: https://developer.apple.com/documentation/safariservices/sfsafariapplication/1639493-openwindow


"The URL to navigate to. The URL scheme must be

http
or
https
."


I am not sure what you are trying to achieve, but I've gotten confirmation from Apple Support that one can not load bundled HTML content (settings page in HTML for example) via the openTab method, so I suspect there scheme limitations exist.


Alternatively you can open a tab via javascript by way of your inject script, but it will be blocked by Safari's popup blocker since it isn't a trusted event, so you might be out of luck for something reliable.

Open an about:blank tab in a Safari App Extension
 
 
Q