John Smith
John Smith

Reputation: 1

Executing Javascript Code From Objective C

I have some javascript code that I need to execute from an objective-c (iPhone) app.

The javascript code needs some of the values from the iPhone app. What I mean is, there is a spot in the iPhone app (a textbox) for a user to type their name. Then the javascript code that runs will be: alert(name)

where the name variable is really textbox.text

How can I do this from objective-c, without relying on an external webserver?

Thank you!

Upvotes: 0

Views: 358

Answers (1)

Duncan Smart
Duncan Smart

Reputation: 32058

Add a UIWebView and inject a <script> tag containing the JavaScript using [webview loadHTMLString: html]

Upvotes: 1

Related Questions