1

Is there a way to call a JavaScript function from an Objective-C method without using a web view? What I want to do is to simulate pressing a link (say Add) on a webpage, whenever an NSButton is pressed. I know which JavaScript function is called, whenever 'Add' is pressed.

I don't have a web view in the app and this is not an iPhone app.

1 Answer 1

2

This is not an iPhone app.

In this case, you're lucky - you can use the JavaScriptCore framework for calling JavaScript from C programs.

(For future reference: this framework is also available on iOS, but it's private - you can use it for in-house and jailbroken development, but not in an AppStore app. Opensource ports of Apple's JavaScriptCore exist as well, as pointed out by @JustSid.)

Sign up to request clarification or add additional context in comments.

3 Comments

There are open source ports of JavaScript Core for iOS. Like this one here
@JustSid Thanks! I'll incorporate that one into my answer.
@JustSid,H2CO3 - Thank you guyz for the help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.