1

I want to print variable value of javascript function in xcode console. This is the script

<script language="javascript" type="text/javascript">
function myFunction() {
var abc =@"My Value";
      alert('Hello world');
}
</script>

With help of

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

I able to run function and alert of @"Hello world" is display.

My main concern is NSLog(@"abc Value %@",?); How to access abc value ="My Value";

I am new in javascript and don't have much knowledge of basic of javascript.

waiting for replay'

Thanks

pallavi_ios
  • 107
  • 1
  • 3
  • 13

1 Answers1

1

See this url

iphone app and uiwebview with javascript code can i access variables?

Community
  • 1
  • 1
Dharmbir Singh
  • 17,485
  • 5
  • 50
  • 66
  • Hi,I run above code in shouldStartLoadWithRequest but string is blank.does i have to change in javascript? – pallavi_ios Aug 08 '13 at 06:30
  • Hi i have run in webViewDidFinishLoad delegate but still string is blank. i run in all possible ways.what is wrong? – pallavi_ios Aug 08 '13 at 06:45
  • see this url for more info .... http://stackoverflow.com/questions/13747558/iphone-app-and-uiwebview-with-javascript-code-can-i-access-variables – Dharmbir Singh Aug 08 '13 at 06:55