开发者

How to launch a native OSX app (and pass parameters) from the web?

开发者 https://www.devze.com 2023-01-23 09:07 出处:网络
I\'m trying to launch a MacOSX app from a 开发者_StackOverflow社区website and pass an authentication token from the web server. I\'m trying to do something like myNewURLScheme://myauthtoken (similar t

I'm trying to launch a MacOSX app from a 开发者_StackOverflow社区website and pass an authentication token from the web server. I'm trying to do something like myNewURLScheme://myauthtoken (similar to the iTunes itms:// URLs) but this doesn't seem to work. (Admittedly, I'm probably doing it wrong.)

  1. Is this the best way to do it? (If not what is?)
  2. How is this supposed to work? I've tried looking at "Installing a Get URL Handler" in the docs: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/SAppsHandleAEs.html, but it doesn't seem to work.

Thanks!


See here for how to get an application to have its own url scheme. You'll want to follow steps 1 thru 3 of georgebrock's post. I'm not sure how you'll get a website to pass the url to the computer though. The easiest way I can think of is to have Mail.app running on the mac and set up a mail rule. The rule can be set up to run an applescript... the applescript launches the application.


http://www.xmldatabases.org/WK/blog/1154_Handling_URL_schemes_in_Cocoa.item

This is the only one that really worked for me! Flawless.

0

精彩评论

暂无评论...
验证码 换一张
取 消