Reputation:
I have a html content of url:
let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {
(data, response, error) in
(url!) is url which is loading and:
let urlContent = String(data: data!, encoding: NSUTF8StringEncoding)
So, urlContent is html content of url which is loading.I have a string
let string = "Custom string in html content"
which i want to add in urlContent, between <body> </body>
tags
How can i do this? Thanks
Upvotes: 1
Views: 64
Reputation: 652
-(void)webViewDidFinishLoad:(UIWebView *)webView {
[_WebViewPrograma stringByEvaluatingJavaScriptFromString:**(your js here)**];
[_WebViewPrograma stringByEvaluatingJavaScriptFromString:@"myFunction();"];
}
Use this code, if there is anything that you might need, I will try to help
Upvotes: 1