Search code examples
safari-extension

Is it possible to use a textarea for a Safari extension settings?


I've made a couple small Safari extensions. For one of them, I would like to collect a set of user-entered strings (e.g., URLs or URL patterns) using a textarea in the settings screen. The only setting types offered in the documentation are one line text, check box, slider, select lists, and radio buttons. I could use a one line text field as an ugly workaround, but I'm hoping there's a better option. I've googled for hints and looked through Safari extensions in GitHub, but haven't found an example of anyone doing this yet.

Does anyone have an example of how to use a textarea for a Safari extensions setting? Is there an undocumented feature I've not been able to find? Or is there a way to trigger a custom popup window from the settings?

Thanks for any tips.


Solution

  • No, there is no way to build a more complex UI inside the settings dialog. What extensions typically do is add a button (checkbox, even if it's not quite the correct element) in the settings page which then launches a separate Safari page which contains the full settings UI, written in HTML.

    For an example of this, install uBlock and take a look at how it launches its setting UI.