3

I’ve got an UIWebView inside an Cocoa Touch application.

I would like to have an <input type='submit'> or <input type='button'>, and if the user presses this button, then I would like to react inside the application.

Is there a delegate/callback/javascript solution to do this?

Best regards

ch.h

Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
Ch.H
  • 41
  • 1

1 Answers1

1

First, in your web view, you need to trigger the loading of a URL that uses a custom URL scheme (e.g. appAction://).

Then implement webView:shouldStartLoadWithRequest:navigationType: in your UIWebView's delegate, and in that method, catch the loading of that URL scheme. Use the rest of the URL as you see fit to determine what action to take.

You can find much more detail on how to do this in this stackoverflow question.

Community
  • 1
  • 1
macserv
  • 3,546
  • 1
  • 26
  • 36