简体   繁体   中英

Call Objective-C from Safari javascript?

On OSX (say Yosemite), I'd like a way to call Objective-C from Safari/javascript. Is there a way to do this?


Not what I'm looking for:

  • embed a WebView / WKWebView in an app
  • Start/control/load Safari from Objective-C
  • use JXA outside of Safari (unless it connects in a way that let's me bridge to Objective-C from inside-Safari javascript).

No. There is no way to do this. The only interface to the client machine is the API which the browser provides.

I came across this reference. So the answer appears to be: yes if you are writing a plugin.

https://developer.apple.com/library/archive/documentation/AppleApplications/Conceptual/SafariJSProgTopics/ObjCFromJavaScript.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM