Reputation: 4848
I am loading HTML string in UIWebView. In that screen, when user selects particular text, I show option to save that string and store that string somewhere. Now, the next time user loads same page, the text which was saved by user, should be automatically highlighted. How would I achieve this?
Upvotes: 0
Views: 2148
Reputation: 7389
I think you could manipulate the website via javascript
. Just save the string to highlight and the corresponding site.
When the user enters the page again have a look if you already have a highlighted string for this site & user. If yes you can manipulate the site via:
[webview stringByEvaluatingJavaScriptFromString:jsCode];
Here is a jsfiddle for example to highlight text via javascript:demo
EDIT A useful collection of answers concerning how to select specific text on a website via javascript can also be found here: Highlighting text using javascript
Upvotes: 1