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 :
NSString * highlighted = [_webView stringByEvaluatingJavaScriptFromString:@"window.getSelection().toString()"];
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