OS X System Preferences URL Scheme

前端 未结 1 1523
迷失自我
迷失自我 2021-02-02 17:18

I’m trying to open the Notifications preference pane (in OS X SystemPreferences.app) via a link. The prefix x-apple.systempreferences:// works so far for opening th

1条回答
  •  -上瘾入骨i
    2021-02-02 18:05

    You can open a preference pane via the URL scheme using the preference pane's bundle identifier:

    x-apple.systempreferences:com.apple.preference.notifications
    

    If you need to reference an anchor via this scheme you can do so using a query parameter:

    x-apple.systempreferences:com.apple.preferences.sharing?Services_ScreenSharing
    

    Note that this scheme is new in 10.10. Use AppleScript or the file open method if support for previous releases is required.

    Update: Apple has restricted use of the URL scheme in 10.11. As of this release only preference panes with NSPrefPaneAllowsXAppleSystemPreferencesURLScheme set in their Info.plist can be opened via the URL scheme.

    0 讨论(0)
提交回复
热议问题