How to create a weblink to open a osx desktop application?
I was wondering is it possible to create a web link so that when a user click's on it, it will open up a OSX applicat开发者_C百科ion - How could I make like in terminal - open myapp.app
Or am I violating some OSX rule?
If you want to open your app, one way is to make your app handle a URL scheme, say x-my-app-scheme://
. This can be done following the methods described in this Apple document. You also need to set CFBundleURLTypes
in your Info.plist
, as described there.
Then in your web page, make an href
to x-my-app-scheme://foo
.
You can't open an arbitrary app from a link in a web site. That would be a grave security hole; consider using that behavior from a Javascript.
精彩评论