0

Possible Duplicate:
iOS JavaScript bridge

i am having one webview and one UIButton . i want to make javascript call from native code . How can i be able to do that .

0

3 Answers 3

1
NSString *param =@"Mango";       
[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"JSMethod('%@')", param]];
Sign up to request clarification or add additional context in comments.

5 Comments

from ibaction i need to call this function or webview delegate
If you wanna call the JS method on click of the button,you need to put this logic in the IBAction. If you wanna call the JS method while loading page into UIWebView,put this logic in delegate method webViewDidStartLoad ..
can you send me some sample code for that
thanks it worked i was doing some mistake ....
1

Follow these links. Using an html button to call a javascript function

http://devlicio.us/blogs/sergio_pereira/archive/2009/02/09/javascript-5-ways-to-call-a-function.aspx

http://www.webmasterworld.com/javascript/3749371.htm?highlight=msg3753441

These may help

Comments

0

This may help you to solve your query:

[webView stringByEvaluatingJavaScriptFromString:@"myJSFunction()"];

2 Comments

from IBAction i need to call this function or webview delegate
Anywhere you need to call that function.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.