I am trying to upload an HTML page with text fields to a web view, edit the text in the text fields and then retrieve the HTML data in this web view.
I use this code to load the page:
NSString* path = [[NSBundle mainBundle] pathForResource:@"file" ofType:@"htm"]; NSData* xmlData = [NSData dataWithContentsOfFile:path]; [web loadData:xmlData MIMEType:@"text/html" textEncodingName:nil baseURL:nil];
And this code to get the content and install it again in webview:
NSString *myText = [web stringByEvaluatingJavaScriptFromString:@"document.all[0].innerHTML"]; data = [myText dataUsingEncoding:NSUTF8StringEncoding]; [web loadData:data MIMEType:@"text/html" textEncodingName:nil baseURL:nil];
The problem is that the text that I pasted into the text box is not coming back from the web view.
I tried document.body.innerHTML and document.body.outerHTML , they all return HTML page data the way I loaded it.
Is there anyway to get the data from the HTML page containing the text that I inserted there?
Basel source share