0

I need to get or capture the JavaScript command executed when I tap on a button or a menu into a web from UIWebView

I don't know wich functtion uses a site to upload a file so I need to capture it.

The purpose of this is to make a javascript file upload by just tapping a UIButton. The JS executes into the UIWebView with [webView stringByEvaluatingJavaScriptFromString:@"js_code_here"];

There is any way to do that?

Cezar
  • 55,636
  • 19
  • 86
  • 87
isiaatz
  • 1,125
  • 4
  • 15
  • 22

2 Answers2

0

You can parse the HTML if you know the element id or class associated with the button/menu.

sixthcent
  • 1,150
  • 7
  • 6
0

try this to call js file within xcode project.,

- (void)markHighlightedString
{
    // The JS File
    NSString *filePath  = [[NSBundle mainBundle] pathForResource:@"HighlightedString" ofType:@"js" inDirectory:@""]; // your js file name
    NSData *fileData    = [NSData dataWithContentsOfFile:filePath];
    NSString *jsString  = [[NSMutableString alloc] initWithData:fileData encoding:NSUTF8StringEncoding];
    [webview stringByEvaluatingJavaScriptFromString:jsString];

    // The JS Function
    NSString *startSearch   = [NSString stringWithFormat:@"stylizeHighlightedString()"]; // your js function which you want to call
    [webview stringByEvaluatingJavaScriptFromString:startSearch];
}

Hope this helps, thanks. Happy coding

Dhruvik
  • 984
  • 4
  • 18