I'm creating an Mac app that loads some content from a URL in a WebView and then needs to save the content to a file. The content may and may not be HTML. Loading works fine, the problem is to get the content from the WebView. How do I do that?
Thanks!
I do not know if you use WebView (MacOS) or UIWebVoew (iOS...). I use the following code (in MacOS) which works well for me:
WebFrame *frame = [myWebView mainFrame];
WebDataSource *source = [frame dataSource];
NSData *data = [source data];
NSString *str = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
[someTextView setString:str]; // shows the content of myWebView as string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With