How can I expose an Objective-C function to JavaScript using WebKit on Mac OS X?

Posted by Luke on Stack Overflow See other posts from Stack Overflow or by Luke
Published on 2010-05-11T08:18:44Z Indexed on 2010/05/11 8:24 UTC
Read the original article Hit count: 288

Filed under:
|
|
|

I understand to do this on the iPhone you need to trap link requests (as per my other iPhone question UIWebView Expose JavaScript) and you can easily do the reverse and access JavaScript from Obj-C code.

However, I would like to have JavaScript be able to call some Objective-C functions that would somehow be registered with WebKit. I assume that you can do this better than trapping links like on the iPhone as on Mac OS X we have access to the full WebKit.

I wish to basically do the reverse of Using JavaScript from Objective-C

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about webkit