I’m trying to access the currently selected text in a UIWebView using the following line of code:
NSString *highlighted = [_webView stringByEvaluatingJavaScriptFromString:@"window.getSelection();"];
But it only returns an emtpy string. Any ideas about what I’m missing?
Try with this :