Search code examples
swiftsafari-extension

Open Safari window without toolbar in Safari Extension


I am trying to build macOS Safari Extension, with the ability to open a new window without toolbar, like tailwindapp.com do, in their extension.

If I use this function: https://developer.apple.com/documentation/safariservices/sfsafariapplication/1639493-openwindow then toolbar is visible, and I can't find any variable to hide toolbar in this method.

If I try to open a popup window from js, when it obviously getting blocked. So probably need to open it from the native code


Solution

  • Ok, there's no way to do it, over Safari Extension native code. The only way to do so is through js onclick event (otherwise Safari will block popup). The code for js is:

    window.open("https://yahoo.com", "title", "status=no,menubar=no,resizable=yes,width=400,height=400,top=4,left=6").focus()